ctf: add hashcode and equals to CTFCallsite
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 18 Jul 2014 21:18:27 +0000 (17:18 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 25 Jul 2014 22:07:42 +0000 (18:07 -0400)
Change-Id: Ia63701468c591a78a37ae245964d80993e39fb5b
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/30150
Tested-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/CTFCallsite.java

index e9340b58307cfbe7f51197f459faf38d2cdde9f9..79948d5cd6bd44e9002c41805bad93055c4dfae6 100644 (file)
@@ -148,6 +148,61 @@ public class CTFCallsite implements Comparable<CTFCallsite> {
         return 0;
     }
 
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((fEventName == null) ? 0 : fEventName.hashCode());
+        result = prime * result + ((fFileName == null) ? 0 : fFileName.hashCode());
+        result = prime * result + ((fFunctionName == null) ? 0 : fFunctionName.hashCode());
+        result = prime * result + (int) (fIp ^ (fIp >>> 32));
+        result = prime * result + (int) (fLineNumber ^ (fLineNumber >>> 32));
+        return result;
+    }
+
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj == null) {
+            return false;
+        }
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+        CTFCallsite other = (CTFCallsite) obj;
+        if (fEventName == null) {
+            if (other.fEventName != null) {
+                return false;
+            }
+        } else if (!fEventName.equals(other.fEventName)) {
+            return false;
+        }
+        if (fFileName == null) {
+            if (other.fFileName != null) {
+                return false;
+            }
+        } else if (!fFileName.equals(other.fFileName)) {
+            return false;
+        }
+        if (fFunctionName == null) {
+            if (other.fFunctionName != null) {
+                return false;
+            }
+        } else if (!fFunctionName.equals(other.fFunctionName)) {
+            return false;
+        }
+        if (fIp != other.fIp) {
+            return false;
+        }
+        if (fLineNumber != other.fLineNumber) {
+            return false;
+        }
+        return true;
+    }
+
     @Override
     public String toString() {
         return fFileName + "/" + fFunctionName + ":" + fLineNumber; //$NON-NLS-1$ //$NON-NLS-2$
This page took 0.027106 seconds and 5 git commands to generate.