Clean up code.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / IntegerDeclaration.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 java.nio.ByteOrder;
16
17 /**
18 * <b><u>IntegerDeclaration</u></b>
19 */
20 public class IntegerDeclaration implements IDeclaration {
21
22 // ------------------------------------------------------------------------
23 // Attributes
24 // ------------------------------------------------------------------------
25
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;
33
34 // ------------------------------------------------------------------------
35 // Constructors
36 // ------------------------------------------------------------------------
37
38 public IntegerDeclaration(int len, boolean signed, int base,
39 ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
40 this.length = len;
41 this.signed = signed;
42 this.base = base;
43 this.byteOrder = byteOrder;
44 this.encoding = encoding;
45 this.clock = clock;
46 this.alignment = alignment;
47 }
48
49 // ------------------------------------------------------------------------
50 // Gettters/Setters/Predicates
51 // ------------------------------------------------------------------------
52
53 public boolean isSigned() {
54 return signed;
55 }
56
57 public int getBase() {
58 return base;
59 }
60
61 public ByteOrder getByteOrder() {
62 return byteOrder;
63 }
64
65 public Encoding getEncoding() {
66 return encoding;
67 }
68
69 public boolean isCharacter() {
70 return (length == 8) && (encoding != Encoding.NONE);
71 }
72
73 public int getLength() {
74 return length;
75 }
76
77 @Override
78 public long getAlignment(){
79 return alignment;
80 }
81
82 public String getClock(){
83 return clock;
84 }
85 // ------------------------------------------------------------------------
86 // Operations
87 // ------------------------------------------------------------------------
88
89 @Override
90 public IntegerDefinition createDefinition(IDefinitionScope definitionScope,
91 String fieldName) {
92 return new IntegerDefinition(this, definitionScope, fieldName);
93 }
94
95 @Override
96 public String toString() {
97 /* Only used for debugging */
98 return "[declaration] integer[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
99 }
100
101 }
This page took 0.032915 seconds and 5 git commands to generate.