Merge branch 'master' of https://github.com/markus-s24/jedis into markus-s24-master

This commit is contained in:
Jungtaek Lim
2014-08-29 14:19:41 +09:00
2 changed files with 33 additions and 10 deletions

View File

@@ -23,6 +23,14 @@ public class ZParams {
private List<byte[]> params = new ArrayList<byte[]>();
/**
* Set weights.
*
* @param weights
* weights.
* @deprecated Use {@link #weightsByDouble(double...)} instead
*/
@Deprecated
public ZParams weights(final int... weights) {
params.add(WEIGHTS.raw);
for (final int weight : weights) {
@@ -32,6 +40,21 @@ public class ZParams {
return this;
}
/**
* Set weights.
*
* @param weights
* weights.
*/
public ZParams weightsByDouble(final double... weights) {
params.add(WEIGHTS.raw);
for (final double weight : weights) {
params.add(Protocol.toByteArray(weight));
}
return this;
}
public Collection<byte[]> getParams() {
return Collections.unmodifiableCollection(params);
}