Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added JavaDoc for GeoRadiusResponse #3542

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions src/main/java/redis/clients/jedis/resps/GeoRadiusResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
import redis.clients.jedis.util.SafeEncoder;

import java.util.Arrays;
import java.util.Objects;

public class GeoRadiusResponse {

private byte[] member;
private double distance;
private GeoCoordinate coordinate;
Expand All @@ -23,6 +25,10 @@ public void setCoordinate(GeoCoordinate coordinate) {
this.coordinate = coordinate;
}

public void setRawScore(long rawScore) {
this.rawScore = rawScore;
}

public byte[] getMember() {
return member;
}
Expand All @@ -31,22 +37,30 @@ public String getMemberByString() {
return SafeEncoder.encode(member);
}

/**
* @return The distance of the returned item from the specified center. The distance is returned
* in the same unit as the unit specified as the radius argument of the command.
*/
public double getDistance() {
return distance;
}

/**
* @return The longitude,latitude coordinates of the matching item.
*/
public GeoCoordinate getCoordinate() {
return coordinate;
}

/**
* @return The raw geohash-encoded sorted set score of the item, in the form of a 52 bit unsigned
* integer. This is only useful for low level hacks or debugging and is otherwise of little
* interest for the general user.
*/
public long getRawScore() {
return rawScore;
}

public void setRawScore(long rawScore) {
this.rawScore = rawScore;
}

@Override
public boolean equals(Object obj) {
if (obj == this) {
Expand All @@ -62,4 +76,14 @@ public boolean equals(Object obj) {
&& rawScore == response.getRawScore() && coordinate.equals(response.coordinate)
&& Arrays.equals(member, response.getMember());
}

@Override
public int hashCode() {
int hash = 7;
hash = 67 * hash + Arrays.hashCode(this.member);
hash = 67 * hash + (int) (Double.doubleToLongBits(this.distance) ^ (Double.doubleToLongBits(this.distance) >>> 32));
hash = 67 * hash + Objects.hashCode(this.coordinate);
hash = 67 * hash + (int) (this.rawScore ^ (this.rawScore >>> 32));
return hash;
}
}