tmf/lttng: Fix newly-introduced Javadoc warnings
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / tmf / core / ctfadaptor / CtfTmfEventField.java
index 70aeb7528378770f0f1b0760d48fdf5db21172a3..4d7918e9283b676a17120c74f959bb3a3d392a90 100644 (file)
@@ -6,8 +6,11 @@
  * accompanies this distribution, and is available at
  * http://www.eclipse.org/legal/epl-v10.html
  *
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Alexendre Montplaisir - Initial API and implementation
+ * Contributors:
+ *  Matthew Khouzam - Initial API and implementation
+ *  Alexendre Montplaisir - Initial API and implementation
+ *  Bernd Hufmann - Add Enum field handling
+ *
  *******************************************************************************/
 
 package org.eclipse.linuxtools.tmf.core.ctfadaptor;
@@ -27,7 +30,7 @@ import org.eclipse.linuxtools.tmf.core.event.ITmfEventField;
 /**
  * The CTF implementation of the TMF event field model
  *
- * @version 1.0
+ * @version 2.0
  * @author Matthew Khouzam
  * @author Alexandre Montplaisir
  */
@@ -37,22 +40,26 @@ public abstract class CtfTmfEventField implements ITmfEventField {
     // Class attributes
     // ------------------------------------------------------------------------
 
-    /** @since 1.1 */
+    /** @since 2.0 */
     protected static final int FIELDTYPE_INTEGER = 0;
 
-    /** @since 1.1 */
+    /** @since 2.0 */
     protected static final int FIELDTYPE_STRING = 1;
 
-    /** @since 1.1 */
+    /** @since 2.0 */
     protected static final int FIELDTYPE_INTEGER_ARRAY = 2;
 
-    /** @since 1.1 */
+    /** @since 2.0 */
     protected static final int FIELDTYPE_FLOAT = 3;
 
+    /** @since 2.0 */
+    protected static final int FIELDTYPE_ENUM = 4;
+
     // ------------------------------------------------------------------------
     // Attributes
     // ------------------------------------------------------------------------
 
+    /** The name of this field */
     protected final String name;
 
     // ------------------------------------------------------------------------
@@ -109,7 +116,7 @@ public abstract class CtfTmfEventField implements ITmfEventField {
 
         } else if (fieldDef instanceof EnumDefinition) {
             EnumDefinition enumDef = (EnumDefinition) fieldDef;
-            field = new CTFStringField(enumDef.getValue(), fieldName);
+            field = new CTFEnumField(new CtfEnumPair(enumDef.getValue(), enumDef.getIntegerValue()), fieldName);
 
         } else if (fieldDef instanceof StringDefinition) {
             field = new CTFStringField(
@@ -186,6 +193,8 @@ public abstract class CtfTmfEventField implements ITmfEventField {
         case FIELDTYPE_FLOAT:
             return new CTFFloatField(((CTFFloatField) other).getValue(),
                     other.name);
+        case FIELDTYPE_ENUM:
+            return new CTFEnumField(((CTFEnumField) other).getValue(), other.name);
         default:
             return null;
         }
@@ -445,4 +454,42 @@ final class CTFFloatField extends CtfTmfEventField {
     }
 }
 
+/**
+ * The CTF field implementation for Enum fields
+ *
+ * @author Bernd Hufmann
+ */
+final class CTFEnumField extends CtfTmfEventField {
+
+    private final CtfEnumPair value;
+
+    /**
+     * Constructor for CTFEnumField.
+     *
+     * @param enumValue
+     *            The Enum value consisting of a pair of Enum value name and its long value
+     * @param name
+     *            The name of this field
+     */
+    CTFEnumField(CtfEnumPair enumValue, String name) {
+        super(name);
+        this.value = new CtfEnumPair(enumValue.getFirst(), enumValue.getSecond().longValue());
+    }
+
+    @Override
+    public int getFieldType() {
+        return FIELDTYPE_ENUM;
+    }
+
+    @Override
+    public  CtfEnumPair getValue() {
+        return this.value;
+    }
+
+    @Override
+    public String toString() {
+        return name + '=' + value.toString();
+    }
+}
+
 /* Implement other possible fields types here... */
This page took 0.025921 seconds and 5 git commands to generate.