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 // ------------------------------------------------------------------------
27 private boolean signed
;
29 private ByteOrder byteOrder
;
30 private Encoding encoding
;
32 // ------------------------------------------------------------------------
34 // ------------------------------------------------------------------------
36 public IntegerDeclaration(int len
, boolean signed
, int base
,
37 ByteOrder byteOrder
, Encoding encoding
) {
41 this.byteOrder
= byteOrder
;
42 this.encoding
= encoding
;
45 // ------------------------------------------------------------------------
46 // Gettters/Setters/Predicates
47 // ------------------------------------------------------------------------
49 public boolean isSigned() {
53 public void setSigned(boolean signed
) {
57 public int getBase() {
61 public void setBase(int base
) {
65 public ByteOrder
getByteOrder() {
69 public void setByteOrder(ByteOrder byteOrder
) {
70 this.byteOrder
= byteOrder
;
73 public Encoding
getEncoding() {
77 public void setEncoding(Encoding encoding
) {
78 this.encoding
= encoding
;
81 public void setLength(int length
) {
85 public boolean isCharacter() {
86 return (length
== 8) && (encoding
!= Encoding
.NONE
);
89 public int getLength() {
93 // ------------------------------------------------------------------------
95 // ------------------------------------------------------------------------
98 public IntegerDefinition
createDefinition(IDefinitionScope definitionScope
,
100 return new IntegerDefinition(this, definitionScope
, fieldName
);
104 public String
toString() {
105 /* Only used for debugging */
106 return "[declaration] integer[" + Integer
.toHexString(hashCode()) + ']'; //$NON-NLS-1$