From addf92860f7864bf995f4e60dfc803af55a92f28 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Fri, 13 Jul 2012 17:50:05 -0400 Subject: tmf: Use macro-style definitions for CTF field types The annotations will have to be updated to "@since 1.2" if this doesn't make the 1.1 release. Change-Id: I3a66cef0394bb3dd5f3b1e074ad55579c1a8730f Signed-off-by: Alexandre Montplaisir --- .../tmf/core/ctfadaptor/CtfTmfEventField.java | 32 ++++++++++++++++------ 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java index fea34c79b2..6350772f6d 100644 --- a/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java +++ b/lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java @@ -32,6 +32,22 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEventField; */ public abstract class CtfTmfEventField implements ITmfEventField { + // ------------------------------------------------------------------------ + // Class attributes + // ------------------------------------------------------------------------ + + /** @since 1.1 */ + protected static final int FIELDTYPE_INTEGER = 0; + + /** @since 1.1 */ + protected static final int FIELDTYPE_STRING = 1; + + /** @since 1.1 */ + protected static final int FIELDTYPE_INTEGER_ARRAY = 2; + + /** @since 1.1 */ + protected static final int FIELDTYPE_FLOAT = 3; + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ @@ -148,13 +164,13 @@ public abstract class CtfTmfEventField implements ITmfEventField { */ public static CtfTmfEventField copyFrom(CtfTmfEventField other) { switch (other.getFieldType()) { - case 0: + case FIELDTYPE_INTEGER: return new CTFIntegerField(((CTFIntegerField) other).getValue(), other.name); - case 1: + case FIELDTYPE_STRING: return new CTFStringField(((CTFStringField) other).getValue(), other.name); - case 2: + case FIELDTYPE_INTEGER_ARRAY: return new CTFIntegerArrayField(((CTFIntegerArrayField) other).getValue(), other.name); - case 3: + case FIELDTYPE_FLOAT: return new CTFFloatField(((CTFFloatField) other).getValue(), other.name); default: return null; @@ -243,7 +259,7 @@ final class CTFIntegerField extends CtfTmfEventField { @Override public int getFieldType() { - return 0; + return FIELDTYPE_INTEGER; } @Override @@ -282,7 +298,7 @@ final class CTFStringField extends CtfTmfEventField { @Override public int getFieldType() { - return 1; + return FIELDTYPE_STRING; } @Override @@ -322,7 +338,7 @@ final class CTFIntegerArrayField extends CtfTmfEventField { @Override public int getFieldType() { - return 2; + return FIELDTYPE_INTEGER_ARRAY; } @Override @@ -369,7 +385,7 @@ final class CTFFloatField extends CtfTmfEventField { @Override public int getFieldType() { - return 3; + return FIELDTYPE_FLOAT; } @Override -- cgit v1.2.3