summaryrefslogtreecommitdiff
path: root/altoslib/AltosPointDouble.java
diff options
context:
space:
mode:
Diffstat (limited to 'altoslib/AltosPointDouble.java')
-rw-r--r--altoslib/AltosPointDouble.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/altoslib/AltosPointDouble.java b/altoslib/AltosPointDouble.java
index 4a940676..45e7785e 100644
--- a/altoslib/AltosPointDouble.java
+++ b/altoslib/AltosPointDouble.java
@@ -20,7 +20,19 @@ package org.altusmetrum.altoslib_7;
public class AltosPointDouble {
public double x, y;
- public boolean equals(AltosPointDouble n) {
+ public int hashCode() {
+ return new Double(x).hashCode() ^ new Double(y).hashCode();
+ }
+
+ public boolean equals(Object o) {
+ if (o == null)
+ return false;
+
+ if (!(o instanceof AltosPointDouble))
+ return false;
+
+ AltosPointDouble n = (AltosPointDouble) o;
+
return n.x == x && n.y == y;
}