import java.nio.ByteOrder;
-import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
import org.eclipse.linuxtools.ctf.core.event.types.FloatDeclaration;
import org.junit.Test;
@Test
public void ctorTest() {
for( int i = 1; i < 20; i++) {
- fixture = new FloatDeclaration(i, 32-i, ByteOrder.nativeOrder(), Encoding.NONE, 0);
+ fixture = new FloatDeclaration(i, 32-i, ByteOrder.nativeOrder(), 0);
assertNotNull(fixture);
}
}
@Test
public void getterTest() {
- fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), Encoding.NONE, 0);
+ fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
assertEquals( fixture.getAlignment(), 0);
assertEquals( fixture.getByteOrder(), ByteOrder.nativeOrder());
- assertEquals( fixture.getEncoding(), Encoding.NONE);
assertEquals( fixture.getExponent(), 8);
assertEquals( fixture.getMantissa(), 24);
}
@Test
public void toStringTest() {
- fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), Encoding.NONE, 0);
+ fixture = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
assertTrue(fixture.toString().contains("float")); //$NON-NLS-1$
}
}
import java.nio.ByteOrder;
-import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
import org.eclipse.linuxtools.ctf.core.event.types.FloatDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.FloatDefinition;
import org.eclipse.linuxtools.ctf.core.event.types.IntegerDefinition;
@Test
public void testFloat248() {
- parent = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), Encoding.NONE, 0);
- singleFixture = (FloatDefinition) parent.createDefinition(null, fieldName);
+ parent = new FloatDeclaration(8, 24, ByteOrder.nativeOrder(), 0);
+ singleFixture = parent.createDefinition(null, fieldName);
assertNotNull(singleFixture);
}
@Test
public void testFloat5311() {
- parent = new FloatDeclaration(11, 53, ByteOrder.nativeOrder(), Encoding.NONE, 0);
- doubleFixture = (FloatDefinition) parent.createDefinition(null, fieldName);
+ parent = new FloatDeclaration(11, 53, ByteOrder.nativeOrder(), 0);
+ doubleFixture = parent.createDefinition(null, fieldName);
assertNotNull(doubleFixture);
}
public void testFloat32Bit(){
for(int i = 1; i < 31 ; i++)
{
- parent = new FloatDeclaration(i, 32-i, ByteOrder.nativeOrder(), Encoding.NONE, 0);
- fixture = (FloatDefinition) parent.createDefinition(null, fieldName);
+ parent = new FloatDeclaration(i, 32-i, ByteOrder.nativeOrder(), 0);
+ fixture = parent.createDefinition(null, fieldName);
assertNotNull(fixture);
fixture.setValue(2.0);
assertTrue(fixture.toString().contains("2")); //$NON-NLS-1$
public void testFloat64Bit(){
for(int i = 1; i < 63 ; i++)
{
- parent = new FloatDeclaration(i, 64-i, ByteOrder.nativeOrder(), Encoding.NONE, 0);
- fixture = (FloatDefinition) parent.createDefinition(null, fieldName);
+ parent = new FloatDeclaration(i, 64-i, ByteOrder.nativeOrder(), 0);
+ fixture = parent.createDefinition(null, fieldName);
assertNotNull(fixture);
BitBuffer input = new BitBuffer(java.nio.ByteBuffer.allocateDirect(128));
fixture.read(input);
@Test
public void testFloat48Bit(){
- parent = new FloatDeclaration(12, 32, ByteOrder.nativeOrder(), Encoding.NONE, 0);
- fixture = (FloatDefinition) parent.createDefinition(null, fieldName);
+ parent = new FloatDeclaration(12, 32, ByteOrder.nativeOrder(), 0);
+ fixture = parent.createDefinition(null, fieldName);
assertNotNull(fixture);
BitBuffer input = new BitBuffer(java.nio.ByteBuffer.allocateDirect(128));
fixture.read(input);
VariantDeclaration varDec = new VariantDeclaration();
EnumDeclaration tagDec = new EnumDeclaration(iDec);
ArrayDeclaration arrDec = new ArrayDeclaration(2, iDec);
- FloatDeclaration fDec = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, Encoding.NONE, 8);
+ FloatDeclaration fDec = new FloatDeclaration(8, 24, ByteOrder.BIG_ENDIAN, 8);
tagDec.add(0, 1, ENUM_1);
tagDec.add(2, 3, ENUM_2);
tagDec.add(4, 5, ENUM_3);
import java.util.HashMap;
+/**
+ */
public class CTFClock {
+ /**
+ * Field properties.
+ */
final private HashMap<String, Object> properties = new HashMap<String, Object>();
+ /**
+ * Field name.
+ */
private String name;
+ /**
+ * Method addAttribute.
+ * @param key String
+ * @param value Object
+ */
public void addAttribute(String key, Object value) {
this.properties.put(key, value);
if (key.equals("name")) { //$NON-NLS-1$
}
}
+ /**
+ * Method getName.
+ * @return String
+ */
public String getName() {
return name;
}
+ /**
+ * Method getProperty.
+ * @param key String
+ * @return Object
+ */
public Object getProperty(String key) {
return properties.get(key);
}
public synchronized static EventDeclaration getLostEventDeclaration(){
EventDeclaration lostEvent = new EventDeclaration();
lostEvent.fields = new StructDeclaration(1);
- lostEvent.id = (long) -1;
+ lostEvent.id = -1L;
lostEvent.name = "Lost event"; //$NON-NLS-1$
return lostEvent;
}
/**
* The StreamInputReader that reads this event definition.
*/
- public final StreamInputReader streamInputReader;
+ private final StreamInputReader streamInputReader;
// ------------------------------------------------------------------------
// Constructors
@Override
public String toString() {
- HashMap<String, Definition> f;
+ HashMap<String, Definition> definitions;
List<String> list;
- StringBuilder b = new StringBuilder();
+ StringBuilder retString = new StringBuilder();
+ final String cr = System.getProperty("line.separator");//$NON-NLS-1$
- b.append("Event type: " + declaration.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
- b.append("Timestamp: " + Long.toString(timestamp) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ retString.append("Event type: " + declaration.getName() + cr); //$NON-NLS-1$
+ retString.append("Timestamp: " + Long.toString(timestamp) + cr); //$NON-NLS-1$
if (context != null) {
- f = context.getDefinitions();
+ definitions = context.getDefinitions();
list = context.getDeclaration().getFieldsList();
for (String field : list) {
- b.append(field + " : " + f.get(field).toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ retString.append(field + " : " + definitions.get(field).toString() + cr); //$NON-NLS-1$
}
}
if (fields != null) {
- f = fields.getDefinitions();
+ definitions = fields.getDefinitions();
list = fields.getDeclaration().getFieldsList();
for (String field : list) {
- b.append(field + " : " + f.get(field).toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ retString.append(field + " : " + definitions.get(field).toString() + cr); //$NON-NLS-1$
}
}
- return b.toString();
+ return retString.toString();
}
}
// Attributes
// ------------------------------------------------------------------------
- /* The name of the field in its container */
+ /** The name of the field in its container */
protected final String fieldName;
- /* The complete path of this field */
+ /** The complete path of this field */
protected final String path;
- /*
+ /**
* The definition scope in which this definition is found.
*
* The complete path of a definition is thus the path of the definition
private final int mant;
private final int exp;
private final ByteOrder byteOrder;
- private final Encoding encoding;
private final long alignment;
// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
public FloatDeclaration(int exponent, int mantissa, ByteOrder byteOrder,
- Encoding encoding, long alignment) {
+ long alignment) {
mant = mantissa;
exp = exponent;
this.byteOrder = byteOrder;
- this.encoding = encoding;
this.alignment = alignment;
}
return byteOrder;
}
- /**
- * @return the encoding
- */
- public Encoding getEncoding() {
- return encoding;
- }
-
@Override
public long getAlignment() {
return alignment;
super(definitionScope, fieldName);
this.declaration = declaration;
}
+
// ------------------------------------------------------------------------
// Gettters/Setters/Predicates
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
-
@Override
public void read(BitBuffer input) {
int exp = declaration.getExponent();
int mant = declaration.getMantissa();
- if( (exp + mant) == 32 ){
- value = readRawFloat32(input, mant , exp);
- }
- else if((exp + mant) == 64)
- {
- value = readRawFloat64(input, mant,exp);
- }
- else
- {
+ if ((exp + mant) == 32) {
+ value = readRawFloat32(input, mant, exp);
+ } else if ((exp + mant) == 64) {
+ value = readRawFloat64(input, mant, exp);
+ } else {
value = Double.NaN;
}
}
-
-
- private static double readRawFloat64(BitBuffer input, final int manBits, final int expBits) {
- long low = input.getInt(32, false);
- low = low & 0x00000000FFFFFFFFL;
- long high = input.getInt(32, false);
- high = high & 0x00000000FFFFFFFFL;
- long temp = (high << 32) | low;
- return createFloat(temp, manBits-1, expBits);
+ private static double readRawFloat64(BitBuffer input, final int manBits,
+ final int expBits) {
+ long low = input.getInt(32, false);
+ low = low & 0x00000000FFFFFFFFL;
+ long high = input.getInt(32, false);
+ high = high & 0x00000000FFFFFFFFL;
+ long temp = (high << 32) | low;
+ return createFloat(temp, manBits - 1, expBits);
}
/**
* @param manBits
* @param expBits
*/
- private static double createFloat(long rawValue, final int manBits, final int expBits) {
+ private static double createFloat(long rawValue, final int manBits,
+ final int expBits) {
long manShift = 1L << (manBits);
long manMask = manShift - 1;
long expMask = (1L << expBits) - 1;
- int exp = (int) ((rawValue >> (manBits))&expMask)+1;
+ int exp = (int) ((rawValue >> (manBits)) & expMask) + 1;
long man = (rawValue & manMask);
double expPow = Math.pow(2.0, exp - (1 << (expBits - 1)));
double ret = man * 1.0f;
}
private static double readRawFloat32(BitBuffer input, final int manBits,
- final int expBits) {
+ final int expBits) {
long temp = input.getInt(32, false);
- return createFloat(temp, manBits-1, expBits);
+ return createFloat(temp, manBits - 1, expBits);
}
@Override
return length;
}
+ @Override
public long getAlignment(){
return alignment;
}
/** Handlers for the metadata files */
private final static FileFilter metadataFileFilter = new MetadataFileFilter();
- private final static Comparator<File> metadataComparator = new MetadataComparator();
+ private final static Comparator<File> metadataComparator = new MetadataComparator(); // $codepro.audit.disable fieldJavadoc
/** map of all the event types */
private final HashMap<Long, EventDeclaration> events;
}
}
}
+ try {
+ super.finalize();
+ } catch (Throwable e) {
+ // TODO Auto-generated catch block
+ }
}
// ------------------------------------------------------------------------
if (obj == null) {
return false;
}
- if (getClass() != obj.getClass()) {
+ if (!(obj instanceof CTFTraceReader)) {
return false;
}
CTFTraceReader other = (CTFTraceReader) obj;
/**
* Name of the metadata file in the trace directory
*/
- final String METADATA_FILENAME = "metadata"; //$NON-NLS-1$
+ final static String METADATA_FILENAME = "metadata"; //$NON-NLS-1$
/**
* Size of the metadata packet header, in bytes, computed by hand.
*/
- final int METADATA_PACKET_HEADER_SIZE = 37;
+ final static int METADATA_PACKET_HEADER_SIZE = 37;
// ------------------------------------------------------------------------
// Attributes
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ *
+ * All rights reserved. This program and the accompanying materials are made
+ * available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: Matthew Khouzam - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.ctf.core.event.metadata;
+
+public interface CTFStrings {
+
+ public static final String NONE = "none"; //$NON-NLS-1$
+ public static final String ASCII = "ASCII"; //$NON-NLS-1$
+ public static final String UTF8 = "UTF8"; //$NON-NLS-1$
+ public static final String BIN = "b"; //$NON-NLS-1$
+ public static final String BINARY = "binary"; //$NON-NLS-1$
+ public static final String OCTAL_CTE = "o"; //$NON-NLS-1$
+ public static final String OCT = "oct"; //$NON-NLS-1$
+ public static final String OCTAL = "octal"; //$NON-NLS-1$
+ public static final String POINTER = "p"; //$NON-NLS-1$
+ public static final String X2 = "X"; //$NON-NLS-1$
+ public static final String X = "x"; //$NON-NLS-1$
+ public static final String HEX = "hex"; //$NON-NLS-1$
+ public static final String HEXADECIMAL = "hexadecimal"; //$NON-NLS-1$
+ public static final String UNSIGNED_CTE = "u"; //$NON-NLS-1$
+ public static final String DEC_CTE = "d"; //$NON-NLS-1$
+ public static final String INT_MOD = "i"; //$NON-NLS-1$
+ public static final String DEC = "dec"; //$NON-NLS-1$
+ public static final String DECIMAL = "decimal"; //$NON-NLS-1$
+ public static final String NATIVE = "native"; //$NON-NLS-1$
+ public static final String NETWORK = "network"; //$NON-NLS-1$
+ public static final String BE = "be"; //$NON-NLS-1$
+ public static final String LE = "le"; //$NON-NLS-1$
+ public static final String ALIGN = "align"; //$NON-NLS-1$
+ public static final String MANT_DIG = "mant_dig"; //$NON-NLS-1$
+ public static final String EXP_DIG = "exp_dig"; //$NON-NLS-1$
+ public static final String LOGLEVEL2 = "loglevel"; //$NON-NLS-1$
+ public static final String NAME2 = "name"; //$NON-NLS-1$
+ public static final String EVENT_CONTEXT = "event.context"; //$NON-NLS-1$
+ public static final String FIELDS_STRING = "fields"; //$NON-NLS-1$
+ public static final String CONTEXT = "context"; //$NON-NLS-1$
+ public static final String STREAM_ID = "stream_id"; //$NON-NLS-1$
+ public static final String PACKET_CONTEXT = "packet.context"; //$NON-NLS-1$
+ public static final String ID = "id"; //$NON-NLS-1$
+ public static final String PACKET_HEADER = "packet.header"; //$NON-NLS-1$
+ public static final String EVENT_HEADER = "event.header"; //$NON-NLS-1$
+ public static final String BYTE_ORDER = "byte_order"; //$NON-NLS-1$
+ public static final String UUID_STRING = "uuid"; //$NON-NLS-1$
+ public static final String FALSE2 = "FALSE"; //$NON-NLS-1$
+ public static final String FALSE = "false"; //$NON-NLS-1$
+ public static final String TRUE2 = "TRUE"; //$NON-NLS-1$
+ public static final String TRUE = "true"; //$NON-NLS-1$
+ public static final String MINOR = "minor"; //$NON-NLS-1$
+ public static final String MAJOR = "major"; //$NON-NLS-1$
+
+
+}
}
for (CommonTree event : events) {
parseEvent(event);
- CommonTree name = (CommonTree) event.getChild(0).getChild(1)
- .getChild(0).getChild(0);
- if (DEBUG_) {
- out.write("Name = " + name); //$NON-NLS-1$
- }
- CommonTree id = (CommonTree) event.getChild(1).getChild(1)
- .getChild(0).getChild(0);
if (DEBUG_) {
+ CommonTree name = (CommonTree) event.getChild(0).getChild(1)
+ .getChild(0).getChild(0);
+ CommonTree id = (CommonTree) event.getChild(1).getChild(1)
+ .getChild(0).getChild(0);
out.write("Name = " + name + " Id = " + id + '\n'); //$NON-NLS-1$ //$NON-NLS-2$
}
}
String left = concatenateUnaryStrings(leftStrings);
- if (left.equals("major")) { //$NON-NLS-1$
+ if (left.equals(CTFStrings.MAJOR)) {
if (trace.majortIsSet()) {
throw new ParseException("major is already set"); //$NON-NLS-1$
}
trace.setMajor(getMajorOrMinor(rightNode));
- } else if (left.equals("minor")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.MINOR)) {
if (trace.minorIsSet()) {
throw new ParseException("minor is already set"); //$NON-NLS-1$
}
trace.setMinor(getMajorOrMinor(rightNode));
- } else if (left.equals("uuid")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.UUID_STRING)) {
UUID uuid = getUUID(rightNode);
/*
trace.setUUID(uuid);
}
- } else if (left.equals("byte_order")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.BYTE_ORDER)) {
ByteOrder byteOrder = getByteOrder(rightNode);
/*
} else {
trace.setByteOrder(byteOrder);
}
- } else if (left.equals("packet.header")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.PACKET_HEADER)) {
if (trace.packetHeaderIsSet()) {
throw new ParseException("packet.header already defined"); //$NON-NLS-1$
}
if (stream.idIsSet()) {
if (!trace.packetHeaderIsSet()
- || !trace.getPacketHeader().hasField("stream_id")) { //$NON-NLS-1$
+ || !trace.getPacketHeader().hasField(CTFStrings.STREAM_ID)) {
throw new ParseException(
"Stream has an ID, but there is no stream_id field in packet header."); //$NON-NLS-1$
}
String left = concatenateUnaryStrings(leftStrings);
- if (left.equals("id")) { //$NON-NLS-1$
+ if (left.equals(CTFStrings.ID)) {
if (stream.idIsSet()) {
throw new ParseException("stream id already defined"); //$NON-NLS-1$
}
long streamID = getStreamID(rightNode);
stream.setId(streamID);
- } else if (left.equals("event.header")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.EVENT_HEADER)) {
if (stream.eventHeaderIsSet()) {
throw new ParseException("event.header already defined"); //$NON-NLS-1$
}
}
stream.setEventHeader((StructDeclaration) eventHeaderDecl);
- } else if (left.equals("event.context")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.EVENT_CONTEXT)) {
if (stream.eventContextIsSet()) {
throw new ParseException("event.context already defined"); //$NON-NLS-1$
}
}
stream.setEventContext((StructDeclaration) eventContextDecl);
- } else if (left.equals("packet.context")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.PACKET_CONTEXT)) {
if (stream.packetContextIsSet()) {
throw new ParseException("packet.context already defined"); //$NON-NLS-1$
}
String left = concatenateUnaryStrings(leftStrings);
- if (left.equals("name")) { //$NON-NLS-1$
+ if (left.equals(CTFStrings.NAME2)) {
if (event.nameIsSet()) {
throw new ParseException("name already defined"); //$NON-NLS-1$
}
String name = getEventName(rightNode);
event.setName(name);
- } else if (left.equals("id")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.ID)) {
if (event.idIsSet()) {
throw new ParseException("id already defined"); //$NON-NLS-1$
}
long id = getEventID(rightNode);
event.setId(id);
- } else if (left.equals("stream_id")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.STREAM_ID)) {
if (event.streamIsSet()) {
throw new ParseException("stream id already defined"); //$NON-NLS-1$
}
}
event.setStream(stream);
- } else if (left.equals("context")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.CONTEXT)) {
if (event.contextIsSet()) {
throw new ParseException("context already defined"); //$NON-NLS-1$
}
}
event.setContext((StructDeclaration) contextDecl);
- } else if (left.equals("fields")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.FIELDS_STRING)) {
if (event.fieldsIsSet()) {
throw new ParseException("fields already defined"); //$NON-NLS-1$
}
final StructDeclaration fields = (StructDeclaration) fieldsDecl;
event.setFields(fields);
}
- else if (left.equals("loglevel")){ //$NON-NLS-1$
+ else if (left.equals(CTFStrings.LOGLEVEL2)){
long logLevel = parseUnaryInteger((CommonTree) rightNode.getChild(0)) ;
event.setLogLevel(logLevel);
FloatDeclaration floatDeclaration = null;
ByteOrder byteOrder = trace.getByteOrder();
long alignment = 0;
- int base = 2;
int exponent = 8;
int mantissa = 24;
- Encoding encoding = Encoding.NONE;
-
/* Iterate on all integer children */
for (CommonTree child : children) {
switch (child.getType()) {
}
String left = concatenateUnaryStrings(leftStrings);
- if (left.equals("exp_dig")) { //$NON-NLS-1$
+ if (left.equals(CTFStrings.EXP_DIG)) {
exponent = (int) parseUnaryInteger((CommonTree) rightNode.getChild(0));
- } else if (left.equals("byte_order")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.BYTE_ORDER)) {
byteOrder = getByteOrder(rightNode);
- } else if (left.equals("mant_dig")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.MANT_DIG)) {
mantissa = (int) parseUnaryInteger((CommonTree) rightNode.getChild(0));
- } else if (left.equals("align")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.ALIGN)) {
alignment = getAlignment(rightNode);
} else {
throw new ParseException("Float: unknown attribute " + left); //$NON-NLS-1$
}
}
- floatDeclaration = new FloatDeclaration(exponent, mantissa, byteOrder, encoding, alignment);
+ floatDeclaration = new FloatDeclaration(exponent, mantissa, byteOrder, alignment);
assert (floatDeclaration != null);
return floatDeclaration;
if (left.equals("signed")) { //$NON-NLS-1$
signed = getSigned(rightNode);
- } else if (left.equals("byte_order")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.BYTE_ORDER)) {
byteOrder = getByteOrder(rightNode);
} else if (left.equals("size")) { //$NON-NLS-1$
size = getSize(rightNode);
- } else if (left.equals("align")) { //$NON-NLS-1$
+ } else if (left.equals(CTFStrings.ALIGN)) {
alignment = getAlignment(rightNode);
} else if (left.equals("base")) { //$NON-NLS-1$
base = getBase(rightNode);
if (isUnaryString(firstChild)) {
String strval = concatenateUnaryStrings(rightNode.getChildren());
- if (strval.equals("true") || strval.equals("TRUE")) { //$NON-NLS-1$ //$NON-NLS-2$
+ if (strval.equals(CTFStrings.TRUE) || strval.equals(CTFStrings.TRUE2)) {
ret = true;
- } else if (strval.equals("false") || strval.equals("FALSE")) { //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (strval.equals(CTFStrings.FALSE) || strval.equals(CTFStrings.FALSE2)) {
ret = false;
} else {
throw new ParseException("Invalid boolean value " //$NON-NLS-1$
if (isUnaryString(firstChild)) {
String strval = concatenateUnaryStrings(rightNode.getChildren());
- if (strval.equals("le")) { //$NON-NLS-1$
+ if (strval.equals(CTFStrings.LE)) {
return ByteOrder.LITTLE_ENDIAN;
- } else if (strval.equals("be") || strval.equals("network")) { //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (strval.equals(CTFStrings.BE) || strval.equals(CTFStrings.NETWORK)) {
return ByteOrder.BIG_ENDIAN;
- } else if (strval.equals("native")) { //$NON-NLS-1$
+ } else if (strval.equals(CTFStrings.NATIVE)) {
return trace.getByteOrder();
} else {
throw new ParseException("Invalid value for byte order"); //$NON-NLS-1$
} else if (isUnaryString(firstChild)) {
String strval = concatenateUnaryStrings(rightNode.getChildren());
- if (strval.equals("decimal") || strval.equals("dec") //$NON-NLS-1$ //$NON-NLS-2$
- || strval.equals("d") || strval.equals("i") //$NON-NLS-1$ //$NON-NLS-2$
- || strval.equals("u")) { //$NON-NLS-1$
+ if (strval.equals(CTFStrings.DECIMAL) || strval.equals(CTFStrings.DEC)
+ || strval.equals(CTFStrings.DEC_CTE) || strval.equals(CTFStrings.INT_MOD)
+ || strval.equals(CTFStrings.UNSIGNED_CTE)) {
return 10;
- } else if (strval.equals("hexadecimal") || strval.equals("hex") //$NON-NLS-1$ //$NON-NLS-2$
- || strval.equals("x") || strval.equals("X") //$NON-NLS-1$ //$NON-NLS-2$
- || strval.equals("p")) { //$NON-NLS-1$
+ } else if (strval.equals(CTFStrings.HEXADECIMAL) || strval.equals(CTFStrings.HEX)
+ || strval.equals(CTFStrings.X) || strval.equals(CTFStrings.X2)
+ || strval.equals(CTFStrings.POINTER)) {
return 16;
- } else if (strval.equals("octal") || strval.equals("oct") //$NON-NLS-1$ //$NON-NLS-2$
- || strval.equals("o")) { //$NON-NLS-1$
+ } else if (strval.equals(CTFStrings.OCTAL) || strval.equals(CTFStrings.OCT)
+ || strval.equals(CTFStrings.OCTAL_CTE)) {
return 8;
- } else if (strval.equals("binary") || strval.equals("b")) { //$NON-NLS-1$ //$NON-NLS-2$
+ } else if (strval.equals(CTFStrings.BINARY) || strval.equals(CTFStrings.BIN)) {
return 2;
} else {
throw new ParseException("Invalid value for base"); //$NON-NLS-1$
if (isUnaryString(firstChild)) {
String strval = concatenateUnaryStrings(rightNode.getChildren());
- if (strval.equals("UTF8")) { //$NON-NLS-1$
+ if (strval.equals(CTFStrings.UTF8)) {
return Encoding.UTF8;
- } else if (strval.equals("ASCII")) { //$NON-NLS-1$
+ } else if (strval.equals(CTFStrings.ASCII)) {
return Encoding.ASCII;
- } else if (strval.equals("none")) { //$NON-NLS-1$
+ } else if (strval.equals(CTFStrings.NONE)) {
return Encoding.NONE;
} else {
throw new ParseException("Invalid value for encoding"); //$NON-NLS-1$
IntegerDeclaration intDec = new IntegerDeclaration(8, false, 8,
ByteOrder.BIG_ENDIAN, Encoding.NONE, null, 8);
FloatDeclaration flDec = new FloatDeclaration(8, 24,
- ByteOrder.BIG_ENDIAN, Encoding.NONE, 8);
+ ByteOrder.BIG_ENDIAN, 8);
ArrayDeclaration arrDec = new ArrayDeclaration(2, intDec);
SequenceDeclaration seqDec = new SequenceDeclaration(LEN, intDec);
sDec.addField(INT, intDec);