Skip to content

Commit

Permalink
Added JavaDoc for GeoRadiusResponse (#3542)
Browse files Browse the repository at this point in the history
Also added hashCode()
  • Loading branch information
sazzad16 authored Sep 19, 2023
1 parent bb38c97 commit cae3ce7
Showing 1 changed file with 28 additions and 4 deletions.
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;
}
}

0 comments on commit cae3ce7

Please sign in to comment.