Add support for float fields in a string output.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core / src / org / eclipse / linuxtools / ctf / core / event / types / IntegerDeclaration.java
CommitLineData
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
13package org.eclipse.linuxtools.ctf.core.event.types;
14
15import java.nio.ByteOrder;
16
17/**
18 * <b><u>IntegerDeclaration</u></b>
19 */
20public class IntegerDeclaration implements IDeclaration {
21
22 // ------------------------------------------------------------------------
23 // Attributes
24 // ------------------------------------------------------------------------
25
26 private int length;
27 private boolean signed;
28 private int base;
29 private ByteOrder byteOrder;
30 private Encoding encoding;
efac73b9 31 @SuppressWarnings("unused")
284fdee8 32 private final String clock;
866e5b51
FC
33
34 // ------------------------------------------------------------------------
35 // Constructors
36 // ------------------------------------------------------------------------
37
38 public IntegerDeclaration(int len, boolean signed, int base,
284fdee8 39 ByteOrder byteOrder, Encoding encoding, String clock) {
866e5b51
FC
40 this.length = len;
41 this.signed = signed;
42 this.base = base;
43 this.byteOrder = byteOrder;
44 this.encoding = encoding;
284fdee8 45 this.clock = clock;
866e5b51
FC
46 }
47
48 // ------------------------------------------------------------------------
49 // Gettters/Setters/Predicates
50 // ------------------------------------------------------------------------
51
52 public boolean isSigned() {
53 return signed;
54 }
55
56 public void setSigned(boolean signed) {
57 this.signed = signed;
58 }
59
60 public int getBase() {
61 return base;
62 }
63
64 public void setBase(int base) {
65 this.base = base;
66 }
67
68 public ByteOrder getByteOrder() {
69 return byteOrder;
70 }
71
72 public void setByteOrder(ByteOrder byteOrder) {
73 this.byteOrder = byteOrder;
74 }
75
76 public Encoding getEncoding() {
77 return encoding;
78 }
79
80 public void setEncoding(Encoding encoding) {
81 this.encoding = encoding;
82 }
83
84 public void setLength(int length) {
85 this.length = length;
86 }
87
88 public boolean isCharacter() {
89 return (length == 8) && (encoding != Encoding.NONE);
90 }
91
92 public int getLength() {
93 return length;
94 }
95
96 // ------------------------------------------------------------------------
97 // Operations
98 // ------------------------------------------------------------------------
99
100 @Override
101 public IntegerDefinition createDefinition(IDefinitionScope definitionScope,
102 String fieldName) {
103 return new IntegerDefinition(this, definitionScope, fieldName);
104 }
105
106 @Override
107 public String toString() {
108 /* Only used for debugging */
109 return "[declaration] integer[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
110 }
111
112}
This page took 0.034035 seconds and 5 git commands to generate.