@Test public void testRegionFilter() { Geomem<String, String> g = new Geomem<String, String>(); Predicate<Info<String, String>> predicate = g.createRegionFilter( topLeftLat, topLeftLong, bottomRightLat, bottomRightLong); { assertTrue(predicate.apply(createInfo(topLeftLat - 1, topLeftLong + 1))); assertFalse(predicate.apply(createInfo(topLeftLat + 1, topLeftLong + 1))); assertFalse(predicate.apply(createInfo(topLeftLat - 1, topLeftLong - 1))); assertFalse(predicate.apply(createInfo(topLeftLat - 1, bottomRightLong + 1))); assertFalse(predicate.apply(createInfo(bottomRightLat - 1, bottomRightLong - 1))); } }
@VisibleForTesting Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon, final double bottomRightLat, final double bottomRightLon) { return new Predicate<Info<T, R>>() { @Override public boolean apply(Info<T, R> info) { return info.lat() >= bottomRightLat && info.lat() < topLeftLat && info.lon() > topLeftLon && info.lon() <= bottomRightLon; } }; }
Geomem { @VisibleForTesting Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon, final double bottomRightLat, final double bottomRightLon) { return new Predicate<Info<T, R>>() { @Override public boolean apply(Info<T, R> info) { return info.lat() >= bottomRightLat && info.lat() < topLeftLat && info.lon() > topLeftLon && info.lon() <= bottomRightLon; } }; } }
Geomem { @VisibleForTesting Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon, final double bottomRightLat, final double bottomRightLon) { return new Predicate<Info<T, R>>() { @Override public boolean apply(Info<T, R> info) { return info.lat() >= bottomRightLat && info.lat() < topLeftLat && info.lon() > topLeftLon && info.lon() <= bottomRightLon; } }; }  }
Geomem { @VisibleForTesting Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon, final double bottomRightLat, final double bottomRightLon) { return new Predicate<Info<T, R>>() { @Override public boolean apply(Info<T, R> info) { return info.lat() >= bottomRightLat && info.lat() < topLeftLat && info.lon() > topLeftLon && info.lon() <= bottomRightLon; } }; }  Iterable<Info<T, R>> find(double topLeftLat, double topLeftLon, double bottomRightLat,
            double bottomRightLon, long start, long finish); @SuppressWarnings("unchecked") void add(double lat, double lon, long time, T t); void add(double lat, double lon, long time, T t, R id); void add(double lat, double lon, long time, T t, Optional<R> id); void add(Info<T, R> info); }
Geomem { @VisibleForTesting Predicate<Info<T, R>> createRegionFilter(final double topLeftLat, final double topLeftLon, final double bottomRightLat, final double bottomRightLon) { return new Predicate<Info<T, R>>() { @Override public boolean apply(Info<T, R> info) { return info.lat() >= bottomRightLat && info.lat() < topLeftLat && info.lon() > topLeftLon && info.lon() <= bottomRightLon; } }; }  Iterable<Info<T, R>> find(double topLeftLat, double topLeftLon, double bottomRightLat,
            double bottomRightLon, long start, long finish); @SuppressWarnings("unchecked") void add(double lat, double lon, long time, T t); void add(double lat, double lon, long time, T t, R id); void add(double lat, double lon, long time, T t, Optional<R> id); void add(Info<T, R> info);  }