summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2006-05-11 07:25:50 +0000
committeraclement <aclement>2006-05-11 07:25:50 +0000
commit63a121b159da4867f115a5d99a972ba85c260faf (patch)
tree441c7edb0a9d4333ae6a9d4a5d9baa42055f4181 /org.aspectj.ajdt.core
parent519880eefc4d3bc1467c8c20fb5c284271c10f4f (diff)
downloadaspectj-63a121b159da4867f115a5d99a972ba85c260faf.tar.gz
aspectj-63a121b159da4867f115a5d99a972ba85c260faf.zip
134471 - incremental structure model repair code overhaul - full equals support for when mungers are compared and we care about slocs.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
index dd5de8cad..9091f4603 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceLocation.java
@@ -136,4 +136,26 @@ public class EclipseSourceLocation implements ISourceLocation {
if (getOffset()>=0) { sb.append("::").append(getOffset()); }
return sb.toString();
}
+
+ private volatile int hashCode = -1;
+ public int hashCode() {
+ if (hashCode == -1) {
+ int result = 17;
+ // other parts important?
+ result = 37*result + getLine();
+ result = 37*result + getOffset();
+ result = 37*result + (filename==null?0:filename.hashCode());
+ hashCode = result;
+ }
+ return hashCode;
+ }
+
+ public boolean equals(Object other) {
+ if (! (other instanceof EclipseSourceLocation)) return super.equals(other);
+ EclipseSourceLocation o = (EclipseSourceLocation) other;
+ return
+ getLine()==o.getLine() &&
+ getOffset()==o.getOffset() &&
+ ((filename==null)?(o.filename==null):o.filename.equals(filename));
+ }
}