BoundingBox implements Serializable { public boolean contains(GeoPoint geoPoint) { return isBetween(geoPoint.latitudeE6, this.minLatitudeE6, this.maxLatitudeE6) && isBetween(geoPoint.longitudeE6, this.minLongitudeE6, this.maxLongitudeE6); } BoundingBox(int minLatitudeE6, int minLongitudeE6, int maxLatitudeE6, int maxLongitudeE6); boolean contains(GeoPoint geoPoint); @Override boolean equals(Object obj); GeoPoint getCenterPoint(); double getMaxLatitude(); double getMaxLongitude(); double getMinLatitude(); double getMinLongitude(); @Override int hashCode(); @Override String toString(); final int maxLatitudeE6; final int maxLongitudeE6; final int minLatitudeE6; final int minLongitudeE6; }
@Test public void containsTest() { BoundingBox boundingBox = new BoundingBox(MIN_LATITUDE, MIN_LONGITUDE, MAX_LATITUDE, MAX_LONGITUDE); GeoPoint geoPoint1 = new GeoPoint(MIN_LATITUDE, MIN_LONGITUDE); GeoPoint geoPoint2 = new GeoPoint(0, 0); Assert.assertTrue(boundingBox.contains(geoPoint1)); Assert.assertFalse(boundingBox.contains(geoPoint2)); }