Merge branch 'master' into lttng_2_0_control_dev
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / SequenceDeclaration.java
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
13 package org.eclipse.linuxtools.ctf.core.event.types;
14
15 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
16
17 /**
18 * <b><u>SequenceDeclaration</u></b>
19 */
20 public class SequenceDeclaration implements IDeclaration {
21
22 // ------------------------------------------------------------------------
23 // Attributes
24 // ------------------------------------------------------------------------
25
26 private final IDeclaration elemType;
27 private final String lengthName;
28
29 // ------------------------------------------------------------------------
30 // Constructors
31 // ------------------------------------------------------------------------
32
33 public SequenceDeclaration(String lengthName, IDeclaration elemType) {
34 this.elemType = elemType;
35 this.lengthName = lengthName;
36 }
37
38 // ------------------------------------------------------------------------
39 // Gettters/Setters/Predicates
40 // ------------------------------------------------------------------------
41
42 public IDeclaration getElementType() {
43 return elemType;
44 }
45
46 public String getLengthName() {
47 return lengthName;
48 }
49
50 // ------------------------------------------------------------------------
51 // Operations
52 // ------------------------------------------------------------------------
53
54 @Override
55 public SequenceDefinition createDefinition(
56 IDefinitionScope definitionScope, String fieldName) {
57 SequenceDefinition ret = null;
58 try {
59 ret = new SequenceDefinition(this, definitionScope, fieldName);
60 } catch (CTFReaderException e) {
61 // Temporarily catch this here, eventually this should be thrown
62 // up the call stack
63 e.printStackTrace();
64 }
65 return ret;
66 }
67
68 @Override
69 public String toString() {
70 /* Only used for debugging */
71 return "[declaration] sequence[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
72 }
73
74 }
This page took 0.033781 seconds and 6 git commands to generate.