@Test public void equalsTest() { BoundingBox boundingBox1 = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); BoundingBox boundingBox2 = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); BoundingBox boundingBox3 = new BoundingBox(0, 0, 0, 0); TestUtils.equalsTest(boundingBox1, boundingBox2); Assert.assertNotEquals(boundingBox1, boundingBox3); Assert.assertNotEquals(boundingBox3, boundingBox1); Assert.assertNotEquals(boundingBox1, new Object()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof BoundingBox)) { return false; } BoundingBox other = (BoundingBox) obj; if (Double.doubleToLongBits(this.maxLatitude) != Double.doubleToLongBits(other.maxLatitude)) { return false; } else if (Double.doubleToLongBits(this.maxLongitude) != Double.doubleToLongBits(other.maxLongitude)) { return false; } else if (Double.doubleToLongBits(this.minLatitude) != Double.doubleToLongBits(other.minLatitude)) { return false; } else if (Double.doubleToLongBits(this.minLongitude) != Double.doubleToLongBits(other.minLongitude)) { return false; } return true; }
BoundingBox implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof BoundingBox)) { return false; } BoundingBox other = (BoundingBox) obj; if (Double.doubleToLongBits(this.maxLatitude) != Double.doubleToLongBits(other.maxLatitude)) { return false; } else if (Double.doubleToLongBits(this.maxLongitude) != Double.doubleToLongBits(other.maxLongitude)) { return false; } else if (Double.doubleToLongBits(this.minLatitude) != Double.doubleToLongBits(other.minLatitude)) { return false; } else if (Double.doubleToLongBits(this.minLongitude) != Double.doubleToLongBits(other.minLongitude)) { return false; } return true; } }
BoundingBox implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof BoundingBox)) { return false; } BoundingBox other = (BoundingBox) obj; if (Double.doubleToLongBits(this.maxLatitude) != Double.doubleToLongBits(other.maxLatitude)) { return false; } else if (Double.doubleToLongBits(this.maxLongitude) != Double.doubleToLongBits(other.maxLongitude)) { return false; } else if (Double.doubleToLongBits(this.minLatitude) != Double.doubleToLongBits(other.minLatitude)) { return false; } else if (Double.doubleToLongBits(this.minLongitude) != Double.doubleToLongBits(other.minLongitude)) { return false; } return true; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); }
BoundingBox implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof BoundingBox)) { return false; } BoundingBox other = (BoundingBox) obj; if (Double.doubleToLongBits(this.maxLatitude) != Double.doubleToLongBits(other.maxLatitude)) { return false; } else if (Double.doubleToLongBits(this.maxLongitude) != Double.doubleToLongBits(other.maxLongitude)) { return false; } else if (Double.doubleToLongBits(this.minLatitude) != Double.doubleToLongBits(other.minLatitude)) { return false; } else if (Double.doubleToLongBits(this.minLongitude) != Double.doubleToLongBits(other.minLongitude)) { return false; } return true; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); static BoundingBox fromString(String boundingBoxString); boolean contains(GeoPoint geoPoint); @Override boolean equals(Object obj); GeoPoint getCenterPoint(); double getLatitudeSpan(); double getLongitudeSpan(); @Override int hashCode(); boolean intersects(BoundingBox boundingBox); @Override String toString(); }
BoundingBox implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof BoundingBox)) { return false; } BoundingBox other = (BoundingBox) obj; if (Double.doubleToLongBits(this.maxLatitude) != Double.doubleToLongBits(other.maxLatitude)) { return false; } else if (Double.doubleToLongBits(this.maxLongitude) != Double.doubleToLongBits(other.maxLongitude)) { return false; } else if (Double.doubleToLongBits(this.minLatitude) != Double.doubleToLongBits(other.minLatitude)) { return false; } else if (Double.doubleToLongBits(this.minLongitude) != Double.doubleToLongBits(other.minLongitude)) { return false; } return true; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); static BoundingBox fromString(String boundingBoxString); boolean contains(GeoPoint geoPoint); @Override boolean equals(Object obj); GeoPoint getCenterPoint(); double getLatitudeSpan(); double getLongitudeSpan(); @Override int hashCode(); boolean intersects(BoundingBox boundingBox); @Override String toString(); final double maxLatitude; final double maxLongitude; final double minLatitude; final double minLongitude; }