@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GeoQueryContext that = (GeoQueryContext) o; if (boost != that.boost) return false; if (precision != that.precision) return false; if (geoPoint != null ? !geoPoint.equals(that.geoPoint) : that.geoPoint != null) return false; return neighbours != null ? neighbours.equals(that.neighbours) : that.neighbours == null; }
public GeoPolygonQueryBuilder(String fieldName, List<GeoPoint> points) { if (Strings.isEmpty(fieldName)) { throw new IllegalArgumentException("fieldName must not be null"); } if (points == null || points.isEmpty()) { throw new IllegalArgumentException("polygon must not be null or empty"); } else { GeoPoint start = points.get(0); if (start.equals(points.get(points.size() - 1))) { if (points.size() < 4) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } else { if (points.size() < 3) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } } this.fieldName = fieldName; this.shell = new ArrayList<>(points); if (!shell.get(shell.size() - 1).equals(shell.get(0))) { shell.add(shell.get(0)); } }
if (currLatLon.equals(lastLatLon))
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GeoQueryContext that = (GeoQueryContext) o; if (boost != that.boost) return false; if (precision != that.precision) return false; if (geoPoint != null ? !geoPoint.equals(that.geoPoint) : that.geoPoint != null) return false; return neighbours != null ? neighbours.equals(that.neighbours) : that.neighbours == null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GeoQueryContext that = (GeoQueryContext) o; if (boost != that.boost) return false; if (precision != that.precision) return false; if (geoPoint != null ? !geoPoint.equals(that.geoPoint) : that.geoPoint != null) return false; return neighbours != null ? neighbours.equals(that.neighbours) : that.neighbours == null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; GeoQueryContext that = (GeoQueryContext) o; if (boost != that.boost) return false; if (precision != that.precision) return false; if (geoPoint != null ? !geoPoint.equals(that.geoPoint) : that.geoPoint != null) return false; return neighbours != null ? neighbours.equals(that.neighbours) : that.neighbours == null; }
@Override public boolean equals(Object obj) { if (sameClassAs(obj) == false) { return false; } LegacyInMemoryGeoBoundingBoxQuery other = (LegacyInMemoryGeoBoundingBoxQuery) obj; return fieldName().equalsIgnoreCase(other.fieldName()) && topLeft.equals(other.topLeft) && bottomRight.equals(other.bottomRight); }
public GeoPolygonQueryBuilder(String fieldName, List<GeoPoint> points) { if (Strings.isEmpty(fieldName)) { throw new IllegalArgumentException("fieldName must not be null"); } if (points == null || points.isEmpty()) { throw new IllegalArgumentException("polygon must not be null or empty"); } else { GeoPoint start = points.get(0); if (start.equals(points.get(points.size() - 1))) { if (points.size() < 4) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } else { if (points.size() < 3) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } } this.fieldName = fieldName; this.shell = new ArrayList<>(points); if (!shell.get(shell.size() - 1).equals(shell.get(0))) { shell.add(shell.get(0)); } }
public GeoPolygonQueryBuilder(String fieldName, List<GeoPoint> points) { if (Strings.isEmpty(fieldName)) { throw new IllegalArgumentException("fieldName must not be null"); } if (points == null || points.isEmpty()) { throw new IllegalArgumentException("polygon must not be null or empty"); } else { GeoPoint start = points.get(0); if (start.equals(points.get(points.size() - 1))) { if (points.size() < 4) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } else { if (points.size() < 3) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } } this.fieldName = fieldName; this.shell = new ArrayList<>(points); if (!shell.get(shell.size() - 1).equals(shell.get(0))) { shell.add(shell.get(0)); } }
public GeoPolygonQueryBuilder(String fieldName, List<GeoPoint> points) { if (Strings.isEmpty(fieldName)) { throw new IllegalArgumentException("fieldName must not be null"); } if (points == null || points.isEmpty()) { throw new IllegalArgumentException("polygon must not be null or empty"); } else { GeoPoint start = points.get(0); if (start.equals(points.get(points.size() - 1))) { if (points.size() < 4) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } else { if (points.size() < 3) { throw new IllegalArgumentException("too few points defined for geo_polygon query"); } } } this.fieldName = fieldName; this.shell = new ArrayList<>(points); if (!shell.get(shell.size() - 1).equals(shell.get(0))) { shell.add(shell.get(0)); } }
public List<GeoCluster> reduce(Iterable<GeoCluster> clusters) { GeoBoundingBox bounds = getBounds(clusters); double maxDistance = bounds != null ? factor * bounds.size(unit) : 0.0; List<GeoCluster> reduced = Lists.newLinkedList(clusters); REDUCE: while (true) { for (int i = 0; i < reduced.size(); ++i) { for (int j = i + 1; j < reduced.size(); ++j) { GeoCluster a = reduced.get(i); GeoCluster b = reduced.get(j); if (a.center().equals(b.center()) || maxDistance > 0.0 && GeoPoints.distance(a.center(), b.center(), unit) <= maxDistance) { reduced.remove(a); reduced.remove(b); reduced.add(a.merge(b)); continue REDUCE; } } } break; } return reduced; }
public GeoClusterBuilder add(GeoPoint point) { if (bounds == null) { bounds = new GeoBoundingBox(point); } else if (!bounds.contains(point)) { bounds = bounds.extend(point); maxDistance = factor * bounds.size(unit); } GeoCluster nearest = null; for (GeoCluster cluster : clusters) { if (cluster.center().equals(point)) { nearest = cluster; break; } if (maxDistance > 0.0) { double distance = GeoPoints.distance(cluster.center(), point, unit); if (distance <= maxDistance && cluster.bounds().extend(point).size(unit) <= maxDistance) { nearest = cluster; } } } if (nearest == null) { nearest = new GeoCluster(point); clusters.add(nearest); } else { nearest.add(point); } return this; }