merge commit
authortimkelly
Thu, 27 Aug 2009 14:02:03 -0500
changeset 78 f17d142f8a47
parent 77 2d52d49686f6 (current diff)
parent 76 458fc5858693 (diff)
child 80 4dd05a945fce
merge commit
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java	Thu Aug 27 14:01:23 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32.java	Thu Aug 27 14:02:03 2009 -0500
@@ -93,23 +93,15 @@
 	}
 
 	public BigInteger distanceTo(IAddress other) {
-		if (!(other instanceof Addr32)) {
-			throw new IllegalArgumentException();
-		}
-		return BigInteger.valueOf(((Addr32)other).address - address);
+		return other.getValue().subtract(getValue());
 	}
 
 	public int compareTo(Object other) {
-		if (!(other instanceof Addr32)) {
+		if (!(other instanceof IAddress)) {
 			throw new IllegalArgumentException();
 		}
-		if (address > ((Addr32)other).address) {
-			return 1;
-		}
-		if (address < ((Addr32)other).address) {
-			return -1;
-		}
-		return 0;
+		
+		return getValue().compareTo(((IAddress)other).getValue());
 	}
 
 	public boolean isMax() {
@@ -133,9 +125,9 @@
 	public boolean equals(Object x) {
 		if (x == this)
 			return true;
-		if (!(x instanceof Addr32))
+		if (!(x instanceof IAddress))
 			return false;
-		return this.address == ((Addr32)x).address;
+		return getValue().equals(((IAddress)x).getValue());
 	}
 
 	@Override
--- a/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java	Thu Aug 27 14:01:23 2009 -0500
+++ b/cdt/cdt_6_0_x/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64.java	Thu Aug 27 14:02:03 2009 -0500
@@ -93,10 +93,7 @@
 	}
 
 	public BigInteger distanceTo(IAddress other) {
-		if (! (other instanceof Addr64)) {
-			throw new IllegalArgumentException();
-		}
-		return ((Addr64)other).address.add(address.negate());
+		return other.getValue().subtract(getValue());
 	}
 
 	public boolean isMax() {
@@ -112,16 +109,20 @@
 	}
 
 	public int compareTo(Object other) {
-		return this.address.compareTo(((Addr64)other).address);
+		if (!(other instanceof IAddress)) {
+			throw new IllegalArgumentException();
+		}
+		
+		return getValue().compareTo(((IAddress)other).getValue());
 	}
 
 	@Override
 	public boolean equals(Object x) {
 		if (x == this)
 			return true;
-		if (! (x instanceof Addr64))
+		if (!(x instanceof IAddress))
 			return false;
-		return this.address.equals(((Addr64)x).address);
+		return getValue().equals(((IAddress)x).getValue());
 	}
 
 	@Override