String comparison may return any integer (not only 0, 1 and -1)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / Definition.java
CommitLineData
866e5b51
FC
1/*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
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: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.ctf.core.event.types;
14
ce2388e0 15import org.eclipse.linuxtools.internal.ctf.core.event.io.BitBuffer;
866e5b51
FC
16
17/**
18 * <b><u>Definition</u></b>
19 */
20public abstract class Definition {
21
22 // ------------------------------------------------------------------------
23 // Attributes
24 // ------------------------------------------------------------------------
25
07002e0a 26 /** The name of the field in its container */
866e5b51
FC
27 protected final String fieldName;
28
07002e0a 29 /** The complete path of this field */
866e5b51
FC
30 protected final String path;
31
07002e0a 32 /**
866e5b51
FC
33 * The definition scope in which this definition is found.
34 *
35 * The complete path of a definition is thus the path of the definition
36 * scope DOT the name of the definition (name of the field in its container)
37 */
38 protected final IDefinitionScope definitionScope;
39
40 // ------------------------------------------------------------------------
41 // Constructors
42 // ------------------------------------------------------------------------
43
44 public Definition(IDefinitionScope definitionScope, String fieldName) {
45 this.definitionScope = definitionScope;
46 this.fieldName = fieldName;
47 if (definitionScope != null) {
48 String parentPath = definitionScope.getPath();
49 if (parentPath.length() > 0) {
50 path = parentPath + "." + fieldName; //$NON-NLS-1$
51 } else {
52 path = fieldName;
53 }
54 } else {
55 path = fieldName;
56 }
57
58 /*
59 * System.out.println("[definition] " + this.getClass().getSimpleName()
60 * + " " + path + " created");
61 */
62 }
63
64 // ------------------------------------------------------------------------
65 // Operations
66 // ------------------------------------------------------------------------
67
68 public abstract void read(BitBuffer input);
69
70 @Override
71 public String toString() {
72 return path + '[' + Integer.toHexString(hashCode()) + ']';
73 }
74}
This page took 0.027791 seconds and 5 git commands to generate.