ctf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / scope / RootScope.java
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 a root with accelerated returns for some scopes
20 * of a lexical scope
21 *
22 * @author Matthew Khouzam
23 * @since 3.1
24 */
25 @NonNullByDefault
26 public class RootScope extends LexicalScope {
27
28 /**
29 * The scope constructor
30 */
31 public RootScope() {
32 super(null, ""); //$NON-NLS-1$
33 }
34
35 @Override
36 @Nullable
37 public LexicalScope getChild(String name) {
38 /*
39 * This happens ~40 % of the time
40 */
41 if (name.equals(EVENT_HEADER.toString())) {
42 return EVENT_HEADER;
43 }
44 /*
45 * This happens ~30 % of the time
46 */
47 if (name.equals(FIELDS.toString())) {
48 return FIELDS;
49 }
50 /*
51 * This happens ~30 % of the time
52 */
53 if (name.equals(CONTEXT.toString())) {
54 return CONTEXT;
55 }
56 /*
57 * This happens ~1 % of the time
58 */
59 if (name.equals(PACKET_HEADER.toString())) {
60 return PACKET_HEADER;
61 }
62 return super.getChild(name);
63 }
64
65 }
This page took 0.045457 seconds and 5 git commands to generate.