Commit | Line | Data |
---|---|---|
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 | ||
13 | package org.eclipse.linuxtools.ctf.core.event.types; | |
14 | ||
15 | /** | |
16 | * <b><u>SequenceDeclaration</u></b> | |
17 | */ | |
18 | public class SequenceDeclaration implements IDeclaration { | |
19 | ||
20 | // ------------------------------------------------------------------------ | |
21 | // Attributes | |
22 | // ------------------------------------------------------------------------ | |
23 | ||
24 | private final IDeclaration elemType; | |
25 | private final String lengthName; | |
26 | ||
27 | // ------------------------------------------------------------------------ | |
28 | // Constructors | |
29 | // ------------------------------------------------------------------------ | |
30 | ||
31 | public SequenceDeclaration(String lengthName, IDeclaration elemType) { | |
32 | this.elemType = elemType; | |
33 | this.lengthName = lengthName; | |
34 | } | |
35 | ||
36 | // ------------------------------------------------------------------------ | |
37 | // Gettters/Setters/Predicates | |
38 | // ------------------------------------------------------------------------ | |
39 | ||
40 | public IDeclaration getElementType() { | |
41 | return elemType; | |
42 | } | |
43 | ||
44 | public String getLengthName() { | |
45 | return lengthName; | |
46 | } | |
47 | ||
48 | // ------------------------------------------------------------------------ | |
49 | // Operations | |
50 | // ------------------------------------------------------------------------ | |
51 | ||
52 | @Override | |
53 | public SequenceDefinition createDefinition( | |
54 | IDefinitionScope definitionScope, String fieldName) { | |
55 | return new SequenceDefinition(this, definitionScope, fieldName); | |
56 | } | |
57 | ||
58 | @Override | |
59 | public String toString() { | |
60 | /* Only used for debugging */ | |
61 | return "[declaration] sequence[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$ | |
62 | } | |
63 | ||
64 | } |