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 | ||
13 | package org.eclipse.linuxtools.ctf.core.event.scope; | |
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 | |
23 | * @since 3.1 | |
24 | */ | |
25 | @NonNullByDefault | |
26 | public class EventHeaderVScope extends LexicalScope { | |
27 | ||
28 | /** | |
29 | * Packet header v id string | |
30 | */ | |
31 | public static final LexicalScope PACKET_HEADER_V_ID = new LexicalScope(PACKET_HEADER, "id"); //$NON-NLS-1$ | |
32 | /** | |
33 | * Packet header v timestamp string | |
34 | */ | |
35 | public static final LexicalScope PACKET_HEADER_V_TIMESTAMP = new LexicalScope(PACKET_HEADER, "timestamp"); //$NON-NLS-1$ | |
36 | ||
37 | /** | |
38 | * The scope constructor | |
39 | * | |
40 | * @param parent | |
41 | * The parent node, can be null, but shouldn't | |
42 | * @param name | |
43 | * the name of the field | |
44 | */ | |
45 | public EventHeaderVScope(LexicalScope parent, String name) { | |
46 | super(parent, name); | |
47 | } | |
48 | ||
49 | @Override | |
50 | @Nullable | |
51 | public LexicalScope getChild(String name) { | |
52 | if (name.equals(PACKET_HEADER_V_TIMESTAMP.getName())) { | |
53 | return PACKET_HEADER_V_TIMESTAMP; | |
54 | } | |
55 | if (name.equals(PACKET_HEADER_V_ID.getName())) { | |
56 | return PACKET_HEADER_V_ID; | |
57 | } | |
58 | return super.getChild(name); | |
59 | } | |
60 | } |