ctf: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.ctf.core / src / org / eclipse / tracecompass / ctf / core / event / scope / RootScope.java
CommitLineData
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 13package org.eclipse.tracecompass.ctf.core.event.scope;
70f60307
MK
14
15import org.eclipse.jdt.annotation.NonNullByDefault;
16import 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
70f60307
MK
23 */
24@NonNullByDefault
fbe6fa6f 25public final class RootScope extends LexicalScope {
70f60307
MK
26
27 /**
28 * The scope constructor
29 */
30 public RootScope() {
fbe6fa6f 31 super();
70f60307
MK
32 }
33
34 @Override
35 @Nullable
fbe6fa6f 36 public ILexicalScope getChild(String name) {
70f60307
MK
37 /*
38 * This happens ~40 % of the time
39 */
fbe6fa6f 40 if (name.equals(EVENT_HEADER.getPath())) {
70f60307
MK
41 return EVENT_HEADER;
42 }
43 /*
44 * This happens ~30 % of the time
45 */
fbe6fa6f 46 if (name.equals(FIELDS.getPath())) {
70f60307
MK
47 return FIELDS;
48 }
49 /*
50 * This happens ~30 % of the time
51 */
fbe6fa6f 52 if (name.equals(CONTEXT.getPath())) {
70f60307
MK
53 return CONTEXT;
54 }
55 /*
56 * This happens ~1 % of the time
57 */
fbe6fa6f 58 if (name.equals(PACKET_HEADER.getPath())) {
70f60307
MK
59 return PACKET_HEADER;
60 }
61 return super.getChild(name);
62 }
63
64}
This page took 0.043365 seconds and 5 git commands to generate.