Monster fix: TMF model update + corresponding LTTng adaptations + JUnits
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / event / TmfEventField.java
index 085311eab0be16ceec3b6a5c2038ed3b59e95318..9cbd789af3e0e965feb53fd63139ac52db0ec245 100644 (file)
@@ -16,30 +16,69 @@ package org.eclipse.linuxtools.tmf.event;
  * <b><u>TmfEventField</u></b>
  * <p>
  * A basic event field.
+ * 
+ * TODO: Add support for field hierarchy.
  */
-public class TmfEventField {
+public class TmfEventField implements Cloneable {
 
     // ========================================================================
     // Attributes
     // ========================================================================
 
-    private final Object fValue;
+       private final TmfEventContent fParent;
+    private final String fFieldId;
+    private       Object fValue;
 
     // ========================================================================
     // Constructors
     // ========================================================================
 
     /**
+     * @param parent
+     * @param id
      * @param value
      */
-    public TmfEventField(Object value) {
-        fValue = value;
+    public TmfEventField(TmfEventContent parent, String id, Object value) {
+       fParent  = parent;
+       fFieldId = id;
+        fValue   = value;
+    }
+
+    /**
+     * @param other
+     */
+    public TmfEventField(TmfEventField other) {
+       assert(other != null);
+       fParent  = other.fParent;
+       fFieldId = other.fFieldId;
+               fValue   = other.fValue;
+    }
+
+    @SuppressWarnings("unused")
+       private TmfEventField() {
+       fParent  = null;
+       fFieldId = null;
+        fValue   = null;
     }
 
     // ========================================================================
     // Accessors
     // ========================================================================
 
+    /**
+     * @return
+     */
+    public TmfEventContent getParent() {
+        return fParent;
+    }
+
+    /**
+     * @return
+     */
+    public String getId() {
+        return fFieldId;
+    }
+
     /**
      * @return
      */
@@ -47,16 +86,28 @@ public class TmfEventField {
         return fValue;
     }
 
+    /**
+     * @param value
+     */
+    protected void setValue(Object value) {
+        fValue = value;
+    }
+
     // ========================================================================
     // Operators
     // ========================================================================
 
-    /* (non-Javadoc)
-     * @see java.lang.Object#toString()
-     */
+       /**
+        * Clone: shallow copy by default; override for deep copy.
+        */
+    @Override
+    public TmfEventField clone() {
+       return new TmfEventField(this);
+    }
+
     @Override
        public String toString() {
-        return fValue.toString();
+        return "[TmfEventField(" + fFieldId + ":" + fValue.toString() + ")]";
     }
 
-}
+}
\ No newline at end of file
This page took 0.032951 seconds and 5 git commands to generate.