1 /*******************************************************************************
2 * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
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
9 * Contributors: Matthew Khouzam - Initial API and implementation
10 * Contributors: Simon Marchi - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.ctf
.core
.event
.types
;
16 * <b><u>ArrayDeclaration</u></b>
18 public class ArrayDeclaration
implements IDeclaration
{
20 // ------------------------------------------------------------------------
22 // ------------------------------------------------------------------------
24 private final int length
;
25 private final IDeclaration elemType
;
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
33 * @param length how many elements in the array
34 * @param elemType what type of element is in the array
36 public ArrayDeclaration(int length
, IDeclaration elemType
) {
38 this.elemType
= elemType
;
41 // ------------------------------------------------------------------------
42 // Getters/Setters/Predicates
43 // ------------------------------------------------------------------------
47 * @return the type of element in the array
49 public IDeclaration
getElementType() {
55 * @return how many elements in the array
57 public int getLength() {
62 public long getAlignment() {
63 long retVal
= this.getElementType().getAlignment();
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
71 public ArrayDefinition
createDefinition(IDefinitionScope definitionScope
,
73 return new ArrayDefinition(this, definitionScope
, fieldName
);
77 public String
toString() {
78 /* Only used for debugging */
79 return "[declaration] array[" + Integer
.toHexString(hashCode()) + ']'; //$NON-NLS-1$