Use Double.NEGATIVE/POSITIVE_INFINITY instead of MIN_VALUE and MAX_VALUE to indicate -inf and +inf respectively.
This commit is contained in:
@@ -497,8 +497,8 @@ public class BinaryClient extends Connection {
|
|||||||
|
|
||||||
public void zcount(final byte[] key, final double min, final double max) {
|
public void zcount(final byte[] key, final double min, final double max) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZCOUNT, key, byteArrayMin, byteArrayMax);
|
sendCommand(ZCOUNT, key, byteArrayMin, byteArrayMax);
|
||||||
}
|
}
|
||||||
@@ -506,8 +506,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrangeByScore(final byte[] key, final double min,
|
public void zrangeByScore(final byte[] key, final double min,
|
||||||
final double max) {
|
final double max) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax);
|
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax);
|
||||||
}
|
}
|
||||||
@@ -515,8 +515,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrevrangeByScore(final byte[] key, final double max,
|
public void zrevrangeByScore(final byte[] key, final double max,
|
||||||
final double min) {
|
final double min) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin);
|
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin);
|
||||||
}
|
}
|
||||||
@@ -534,8 +534,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrangeByScore(final byte[] key, final double min,
|
public void zrangeByScore(final byte[] key, final double min,
|
||||||
final double max, final int offset, int count) {
|
final double max, final int offset, int count) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax,
|
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax,
|
||||||
LIMIT.raw, toByteArray(offset), toByteArray(count));
|
LIMIT.raw, toByteArray(offset), toByteArray(count));
|
||||||
@@ -544,8 +544,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrevrangeByScore(final byte[] key, final double max,
|
public void zrevrangeByScore(final byte[] key, final double max,
|
||||||
final double min, final int offset, int count) {
|
final double min, final int offset, int count) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin,
|
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin,
|
||||||
LIMIT.raw, toByteArray(offset), toByteArray(count));
|
LIMIT.raw, toByteArray(offset), toByteArray(count));
|
||||||
@@ -554,8 +554,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrangeByScoreWithScores(final byte[] key, final double min,
|
public void zrangeByScoreWithScores(final byte[] key, final double min,
|
||||||
final double max) {
|
final double max) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax,
|
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax,
|
||||||
WITHSCORES.raw);
|
WITHSCORES.raw);
|
||||||
@@ -564,8 +564,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrevrangeByScoreWithScores(final byte[] key, final double max,
|
public void zrevrangeByScoreWithScores(final byte[] key, final double max,
|
||||||
final double min) {
|
final double min) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin,
|
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin,
|
||||||
WITHSCORES.raw);
|
WITHSCORES.raw);
|
||||||
@@ -574,8 +574,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrangeByScoreWithScores(final byte[] key, final double min,
|
public void zrangeByScoreWithScores(final byte[] key, final double min,
|
||||||
final double max, final int offset, final int count) {
|
final double max, final int offset, final int count) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax,
|
sendCommand(ZRANGEBYSCORE, key, byteArrayMin, byteArrayMax,
|
||||||
LIMIT.raw, toByteArray(offset), toByteArray(count),
|
LIMIT.raw, toByteArray(offset), toByteArray(count),
|
||||||
@@ -585,8 +585,8 @@ public class BinaryClient extends Connection {
|
|||||||
public void zrevrangeByScoreWithScores(final byte[] key, final double max,
|
public void zrevrangeByScoreWithScores(final byte[] key, final double max,
|
||||||
final double min, final int offset, final int count) {
|
final double min, final int offset, final int count) {
|
||||||
|
|
||||||
byte byteArrayMin[] = (min == Double.MIN_VALUE) ? "-inf".getBytes() : toByteArray(min);
|
byte byteArrayMin[] = (min == Double.NEGATIVE_INFINITY) ? "-inf".getBytes() : toByteArray(min);
|
||||||
byte byteArrayMax[] = (max == Double.MAX_VALUE) ? "+inf".getBytes() : toByteArray(max);
|
byte byteArrayMax[] = (max == Double.POSITIVE_INFINITY) ? "+inf".getBytes() : toByteArray(max);
|
||||||
|
|
||||||
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin,
|
sendCommand(ZREVRANGEBYSCORE, key, byteArrayMax, byteArrayMin,
|
||||||
LIMIT.raw, toByteArray(offset), toByteArray(count),
|
LIMIT.raw, toByteArray(offset), toByteArray(count),
|
||||||
|
|||||||
Reference in New Issue
Block a user