X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=altoslib%2FAltosPointDouble.java;fp=altoslib%2FAltosPointDouble.java;h=45e7785e4c36eca6af585b7b4a354a229e6c61f5;hp=4a94067646ff29c0c2fbb1d60bf36b8fe7c504cf;hb=0cc03210d5d53d12604688f294b6ca39e3a025de;hpb=5568c30f0a4fe346b8ed58934c23653064427d65 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; }