Commit | Line | Data |
---|---|---|
70f60307 MK |
1 | /******************************************************************************* |
2 | * Copyright (c) 2014 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are made | |
5 | * available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Matthew Khouzam - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
f357bcd4 | 13 | package org.eclipse.tracecompass.ctf.core.event.scope; |
70f60307 MK |
14 | |
15 | import org.eclipse.jdt.annotation.NonNullByDefault; | |
16 | import org.eclipse.jdt.annotation.Nullable; | |
17 | ||
18 | /** | |
19 | * A lttng specific speedup node (v variant for event headers) of a lexical | |
20 | * scope they normally contain a timestamp | |
21 | * | |
22 | * @author Matthew Khouzam | |
70f60307 MK |
23 | */ |
24 | @NonNullByDefault | |
25 | public class EventHeaderVScope extends LexicalScope { | |
26 | ||
27 | /** | |
28 | * Packet header v id string | |
29 | */ | |
30 | public static final LexicalScope PACKET_HEADER_V_ID = new LexicalScope(PACKET_HEADER, "id"); //$NON-NLS-1$ | |
31 | /** | |
32 | * Packet header v timestamp string | |
33 | */ | |
34 | public static final LexicalScope PACKET_HEADER_V_TIMESTAMP = new LexicalScope(PACKET_HEADER, "timestamp"); //$NON-NLS-1$ | |
35 | ||
36 | /** | |
37 | * The scope constructor | |
38 | * | |
39 | * @param parent | |
40 | * The parent node, can be null, but shouldn't | |
41 | * @param name | |
42 | * the name of the field | |
43 | */ | |
44 | public EventHeaderVScope(LexicalScope parent, String name) { | |
45 | super(parent, name); | |
46 | } | |
47 | ||
48 | @Override | |
49 | @Nullable | |
50 | public LexicalScope getChild(String name) { | |
51 | if (name.equals(PACKET_HEADER_V_TIMESTAMP.getName())) { | |
52 | return PACKET_HEADER_V_TIMESTAMP; | |
53 | } | |
54 | if (name.equals(PACKET_HEADER_V_ID.getName())) { | |
55 | return PACKET_HEADER_V_ID; | |
56 | } | |
57 | return super.getChild(name); | |
58 | } | |
59 | } |