diff --git a/net.wolfgangwerner.geo/src/net/wolfgangwerner/geo/model/GeoPoint.java b/net.wolfgangwerner.geo/src/net/wolfgangwerner/geo/model/GeoPoint.java index c503d61..bab9350 100644 --- a/net.wolfgangwerner.geo/src/net/wolfgangwerner/geo/model/GeoPoint.java +++ b/net.wolfgangwerner.geo/src/net/wolfgangwerner/geo/model/GeoPoint.java @@ -37,13 +37,20 @@ public void setLongitude(double longitude) { this.longitude = longitude; } - public double distanceInKilometresTo(GeoPoint to, - DistanceCalculationAlgorithm algorithm) { - return algorithm.distanceInKilometres(this, to); + @Override + public boolean equals(Object obj) { + if (!(obj instanceof GeoPoint)) + return false; + + GeoPoint p = (GeoPoint) obj; + return (p.getLatitude() == getLatitude() && p.getLongitude() == getLongitude()); } - public double distanceInKilometresTo(GeoPoint to) { - return DEFAULT_ALGORITHM.distanceInKilometres(this, to); + @Override + public int hashCode() { + return Double.valueOf(latitude).hashCode() + ^ Double.valueOf(longitude).hashCode(); + } }