@Test public void containsTest() { BoundingBox boundingBox = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); LatLong latLong1 = new LatLong(MIN_LATITUDE, MIN_LONGITUDE); LatLong latLong2 = new LatLong(MAX_LATITUDE, MAX_LONGITUDE); LatLong latLong3 = new LatLong(MIN_LONGITUDE, MIN_LONGITUDE); LatLong latLong4 = new LatLong(MAX_LATITUDE, MAX_LATITUDE); Assert.assertTrue(boundingBox.contains(latLong1)); Assert.assertTrue(boundingBox.contains(latLong2)); Assert.assertFalse(boundingBox.contains(latLong3)); Assert.assertFalse(boundingBox.contains(latLong4)); }
public boolean contains(LatLong latLong) { return this.minLatitude <= latLong.latitude && this.maxLatitude >= latLong.latitude && this.minLongitude <= latLong.longitude && this.maxLongitude >= latLong.longitude; }
BoundingBox implements Serializable { public boolean contains(LatLong latLong) { return this.minLatitude <= latLong.latitude && this.maxLatitude >= latLong.latitude && this.minLongitude <= latLong.longitude && this.maxLongitude >= latLong.longitude; } }
BoundingBox implements Serializable { public boolean contains(LatLong latLong) { return this.minLatitude <= latLong.latitude && this.maxLatitude >= latLong.latitude && this.minLongitude <= latLong.longitude && this.maxLongitude >= latLong.longitude; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); }
BoundingBox implements Serializable { public boolean contains(LatLong latLong) { return this.minLatitude <= latLong.latitude && this.maxLatitude >= latLong.latitude && this.minLongitude <= latLong.longitude && this.maxLongitude >= latLong.longitude; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); static BoundingBox fromString(String boundingBoxString); boolean contains(LatLong latLong); @Override boolean equals(Object obj); LatLong getCenterPoint(); double getLatitudeSpan(); double getLongitudeSpan(); @Override int hashCode(); boolean intersects(BoundingBox boundingBox); @Override String toString(); }
BoundingBox implements Serializable { public boolean contains(LatLong latLong) { return this.minLatitude <= latLong.latitude && this.maxLatitude >= latLong.latitude && this.minLongitude <= latLong.longitude && this.maxLongitude >= latLong.longitude; } BoundingBox(double minLatitude, double minLongitude, double maxLatitude, double maxLongitude); static BoundingBox fromString(String boundingBoxString); boolean contains(LatLong latLong); @Override boolean equals(Object obj); LatLong 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; }