Commits

petermr committed 863fbe6

equals in Int2

  • Participants
  • Parent commits faa1187

Comments (0)

Files changed (1)

File src/main/java/org/xmlcml/euclid/Int2.java

         this.x = r.x;
         this.y = r.y;
     }
+    
+    public boolean equals(Object obj) {
+    	if (obj == null || !(obj instanceof Int2)) {
+    		return false;
+    	}
+    	Int2 i2 = (Int2) obj;
+    	return (x == i2.x && y == i2.y);
+    }
+    
+    public int hashCode() {
+    	return 13*x + 37*y;
+    }
+    
     /**
      * swaps the x and y values
      */