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
;
15 import java
.nio
.ByteOrder
;
18 * <b><u>IntegerDeclaration</u></b>
20 public class IntegerDeclaration
implements IDeclaration
{
22 // ------------------------------------------------------------------------
24 // ------------------------------------------------------------------------
26 final private int length
;
27 final private boolean signed
;
28 final private int base
;
29 final private ByteOrder byteOrder
;
30 final private Encoding encoding
;
31 final private long alignment
;
32 final private String clock
;
34 // ------------------------------------------------------------------------
36 // ------------------------------------------------------------------------
38 public IntegerDeclaration(int len
, boolean signed
, int base
,
39 ByteOrder byteOrder
, Encoding encoding
, String clock
, long alignment
) {
43 this.byteOrder
= byteOrder
;
44 this.encoding
= encoding
;
46 this.alignment
= alignment
;
49 // ------------------------------------------------------------------------
50 // Gettters/Setters/Predicates
51 // ------------------------------------------------------------------------
53 public boolean isSigned() {
57 public int getBase() {
61 public ByteOrder
getByteOrder() {
65 public Encoding
getEncoding() {
69 public boolean isCharacter() {
70 return (length
== 8) && (encoding
!= Encoding
.NONE
);
73 public int getLength() {
78 public long getAlignment(){
82 public String
getClock(){
85 // ------------------------------------------------------------------------
87 // ------------------------------------------------------------------------
90 public IntegerDefinition
createDefinition(IDefinitionScope definitionScope
,
92 return new IntegerDefinition(this, definitionScope
, fieldName
);
96 public String
toString() {
97 /* Only used for debugging */
98 return "[declaration] integer[" + Integer
.toHexString(hashCode()) + ']'; //$NON-NLS-1$