@Test public void equalsTest() { GeoPoint geoPoint1 = new GeoPoint(LATITUDE, LONGITUDE); GeoPoint geoPoint2 = new GeoPoint(LATITUDE, LONGITUDE); GeoPoint geoPoint3 = new GeoPoint(0, 0); TestUtils.equalsTest(geoPoint1, geoPoint2); Assert.assertNotEquals(geoPoint1, geoPoint3); Assert.assertNotEquals(geoPoint3, geoPoint1); Assert.assertNotEquals(geoPoint1, new Object()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof GeoPoint)) { return false; } GeoPoint other = (GeoPoint) obj; if (Double.doubleToLongBits(this.latitude) != Double.doubleToLongBits(other.latitude)) { return false; } else if (Double.doubleToLongBits(this.longitude) != Double.doubleToLongBits(other.longitude)) { return false; } return true; }
GeoPoint implements Comparable<GeoPoint>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof GeoPoint)) { return false; } GeoPoint other = (GeoPoint) obj; if (Double.doubleToLongBits(this.latitude) != Double.doubleToLongBits(other.latitude)) { return false; } else if (Double.doubleToLongBits(this.longitude) != Double.doubleToLongBits(other.longitude)) { return false; } return true; } }
GeoPoint implements Comparable<GeoPoint>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof GeoPoint)) { return false; } GeoPoint other = (GeoPoint) obj; if (Double.doubleToLongBits(this.latitude) != Double.doubleToLongBits(other.latitude)) { return false; } else if (Double.doubleToLongBits(this.longitude) != Double.doubleToLongBits(other.longitude)) { return false; } return true; } GeoPoint(double latitude, double longitude); }
GeoPoint implements Comparable<GeoPoint>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof GeoPoint)) { return false; } GeoPoint other = (GeoPoint) obj; if (Double.doubleToLongBits(this.latitude) != Double.doubleToLongBits(other.latitude)) { return false; } else if (Double.doubleToLongBits(this.longitude) != Double.doubleToLongBits(other.longitude)) { return false; } return true; } GeoPoint(double latitude, double longitude); static GeoPoint fromString(String geoPointString); static double latitudeDistance(int meters); static double longitudeDistance(int meters, double latitude); @Override int compareTo(GeoPoint geoPoint); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
GeoPoint implements Comparable<GeoPoint>, Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof GeoPoint)) { return false; } GeoPoint other = (GeoPoint) obj; if (Double.doubleToLongBits(this.latitude) != Double.doubleToLongBits(other.latitude)) { return false; } else if (Double.doubleToLongBits(this.longitude) != Double.doubleToLongBits(other.longitude)) { return false; } return true; } GeoPoint(double latitude, double longitude); static GeoPoint fromString(String geoPointString); static double latitudeDistance(int meters); static double longitudeDistance(int meters, double latitude); @Override int compareTo(GeoPoint geoPoint); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final double latitude; final double longitude; }