Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Montplaisir2012-07-13 17:50:05 -0400
committerAlexandre Montplaisir2012-07-16 11:16:26 -0400
commitaddf92860f7864bf995f4e60dfc803af55a92f28 (patch)
treec1ae55ec8c00b7585a03bb442be3be3aa1f80036
parent12bf733c0bdcc40970d6996d84a39290c9e9847a (diff)
downloadorg.eclipse.linuxtools-addf92860f7864bf995f4e60dfc803af55a92f28.tar.gz
org.eclipse.linuxtools-addf92860f7864bf995f4e60dfc803af55a92f28.tar.xz
org.eclipse.linuxtools-addf92860f7864bf995f4e60dfc803af55a92f28.zip
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 <alexmonthy@voxpopuli.im>
-rw-r--r--lttng/org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/ctfadaptor/CtfTmfEventField.java32
1 files 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
@@ -33,6 +33,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

Back to the top