diff --git a/src/main/java/org/redisson/core/RGeo.java b/src/main/java/org/redisson/core/RGeo.java index c6c32dafc..e07c3c02c 100644 --- a/src/main/java/org/redisson/core/RGeo.java +++ b/src/main/java/org/redisson/core/RGeo.java @@ -19,6 +19,7 @@ import java.util.List; import java.util.Map; /** + * Geospatial items holder * * @author Nikita Koksharov * @@ -26,26 +27,140 @@ import java.util.Map; */ public interface RGeo extends RExpirable, RGeoAsync { + /** + * Adds geospatial member. + * + * @param entries + * @return number of elements added to the sorted set, + * not including elements already existing for which + * the score was updated + */ long add(double longitude, double latitude, V member); + /** + * Adds geospatial members. + * + * @param entries + * @return number of elements added to the sorted set, + * not including elements already existing for which + * the score was updated + */ long add(GeoEntry... entries); + /** + * Returns distance between members in GeoUnit units. + * + * @see {@link GeoUnit} + * + * @param firstMember + * @param secondMember + * @param geoUnit + * @return + */ Double dist(V firstMember, V secondMember, GeoUnit geoUnit); + /** + * Returns 11 characters Geohash string mapped by defined member. + * + * @param members + * @return + */ Map hash(V... members); - + + /** + * Returns geo-position mapped by defined member. + * + * @param members + * @return + */ Map pos(V... members); + /** + * Returns the members of a sorted set, which are within the + * borders of the area specified with the center location + * and the maximum distance from the center (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ List radius(double longitude, double latitude, double radius, GeoUnit geoUnit); - + + /** + * Returns the distance mapped by member, distance between member and the location. + * Members of a sorted set, which are within the + * borders of the area specified with the center location + * and the maximum distance from the center (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Map radiusWithDistance(double longitude, double latitude, double radius, GeoUnit geoUnit); - + + /** + * Returns the geo-position mapped by member. + * Members of a sorted set, which are within the + * borders of the area specified with the center location + * and the maximum distance from the center (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Map radiusWithPosition(double longitude, double latitude, double radius, GeoUnit geoUnit); - + + /** + * Returns the members of a sorted set, which are within the + * borders of the area specified with the defined member location + * and the maximum distance from the defined member location (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ List radius(V member, double radius, GeoUnit geoUnit); - + + /** + * Returns the distance mapped by member, distance between member and the defined member location. + * Members of a sorted set, which are within the + * borders of the area specified with the defined member location + * and the maximum distance from the defined member location (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Map radiusWithDistance(V member, double radius, GeoUnit geoUnit); - + + /** + * Returns the geo-position mapped by member. + * Members of a sorted set, which are within the + * borders of the area specified with the defined member location + * and the maximum distance from the defined member location (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Map radiusWithPosition(V member, double radius, GeoUnit geoUnit); } diff --git a/src/main/java/org/redisson/core/RGeoAsync.java b/src/main/java/org/redisson/core/RGeoAsync.java index e2917d432..15420b385 100644 --- a/src/main/java/org/redisson/core/RGeoAsync.java +++ b/src/main/java/org/redisson/core/RGeoAsync.java @@ -28,26 +28,140 @@ import io.netty.util.concurrent.Future; */ public interface RGeoAsync extends RExpirableAsync { + /** + * Adds geospatial member. + * + * @param entries + * @return number of elements added to the sorted set, + * not including elements already existing for which + * the score was updated + */ Future addAsync(double longitude, double latitude, V member); + /** + * Adds geospatial members. + * + * @param entries + * @return number of elements added to the sorted set, + * not including elements already existing for which + * the score was updated + */ Future addAsync(GeoEntry... entries); + /** + * Returns distance between members in GeoUnit units. + * + * @see {@link GeoUnit} + * + * @param firstMember + * @param secondMember + * @param geoUnit + * @return + */ Future distAsync(V firstMember, V secondMember, GeoUnit geoUnit); + /** + * Returns 11 characters Geohash string mapped by defined member. + * + * @param members + * @return + */ Future> hashAsync(V... members); + /** + * Returns geo-position mapped by defined member. + * + * @param members + * @return + */ Future> posAsync(V... members); + /** + * Returns the members of a sorted set, which are within the + * borders of the area specified with the center location + * and the maximum distance from the center (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Future> radiusAsync(double longitude, double latitude, double radius, GeoUnit geoUnit); + /** + * Returns the distance mapped by member, distance between member and the location. + * Members of a sorted set, which are within the + * borders of the area specified with the center location + * and the maximum distance from the center (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Future> radiusWithDistanceAsync(double longitude, double latitude, double radius, GeoUnit geoUnit); + /** + * Returns the geo-position mapped by member. + * Members of a sorted set, which are within the + * borders of the area specified with the center location + * and the maximum distance from the center (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Future> radiusWithPositionAsync(double longitude, double latitude, double radius, GeoUnit geoUnit); + /** + * Returns the members of a sorted set, which are within the + * borders of the area specified with the defined member location + * and the maximum distance from the defined member location (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Future> radiusAsync(V member, double radius, GeoUnit geoUnit); + /** + * Returns the distance mapped by member, distance between member and the defined member location. + * Members of a sorted set, which are within the + * borders of the area specified with the defined member location + * and the maximum distance from the defined member location (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Future> radiusWithDistanceAsync(V member, double radius, GeoUnit geoUnit); + /** + * Returns the geo-position mapped by member. + * Members of a sorted set, which are within the + * borders of the area specified with the defined member location + * and the maximum distance from the defined member location (the radius) + * in GeoUnit units. + * + * @param longitude + * @param latitude + * @param radius + * @param geoUnit + * @return + */ Future> radiusWithPositionAsync(V member, double radius, GeoUnit geoUnit); }