Rename xxx.lttng to xxx.lttng.core
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf / src / org / eclipse / linuxtools / tmf / event / TmfTraceEvent.java
index f030752f892a2008831bf818328051dda8bf07da..25c05d1bd19783053986f12b0224080d63e67ed2 100644 (file)
@@ -21,20 +21,21 @@ package org.eclipse.linuxtools.tmf.event;
  * <p>
  * TODO: Concept is still a bit vague and should be aligned with the CDT
  * source lookup service.
+ * TODO: Consider composition instead of extension
  */
 public class TmfTraceEvent extends TmfEvent {
 
-    // ========================================================================
+    // ------------------------------------------------------------------------
     // Attributes
-    // ========================================================================
+    // ------------------------------------------------------------------------
 
     private final String fSourcePath;
     private final String fFileName;
     private final int    fLineNumber;
 
-    // ========================================================================
+    // ------------------------------------------------------------------------
     // Constructors
-    // ========================================================================
+    // ------------------------------------------------------------------------
 
        /**
         * @param originalTS
@@ -85,9 +86,9 @@ public class TmfTraceEvent extends TmfEvent {
                fLineNumber = other.fLineNumber;
        }
 
-    // ========================================================================
+    // ------------------------------------------------------------------------
     // Accessors
-    // ========================================================================
+    // ------------------------------------------------------------------------
 
     /**
      * @return
@@ -110,20 +111,38 @@ public class TmfTraceEvent extends TmfEvent {
         return fLineNumber;
     }
 
-    // ========================================================================
-    // Operators
-    // ========================================================================
+    // ------------------------------------------------------------------------
+    // Object
+    // ------------------------------------------------------------------------
 
-    // TODO: Deep copy
     @Override
-    public TmfTraceEvent clone() {
-       return new TmfTraceEvent(this);
+    public int hashCode() {
+               int result = super.hashCode();
+               result = 37 * result + ((fSourcePath != null) ? fSourcePath.hashCode() : 0);
+               result = 37 * result + ((fFileName   != null) ? fFileName.hashCode()   : 0);
+               result = 37 * result + fLineNumber;
+        return result;
+    }
+
+    @Override
+       public boolean equals(Object other) {
+       if (other instanceof TmfEvent) {
+               return super.equals(other); 
+       }
+       if (!(other instanceof TmfTraceEvent)) {
+               return false; 
+       }
+               TmfTraceEvent o = (TmfTraceEvent) other;
+        return super.equals((TmfEvent) o) && fSourcePath.equals(o.fSourcePath) &&
+                       fFileName.equals(o.fFileName) && fLineNumber == o.fLineNumber;
+
     }
 
     // TODO: Proper format
     @Override
+    @SuppressWarnings("nls")
     public String toString() {
-       return null;
+               return "[TmfTraceEvent(" + fSourcePath + "," + fFileName + "," + fLineNumber + ")]";
     }
 
 }
This page took 0.024785 seconds and 5 git commands to generate.