Class RedisZSetCommands.Weights
java.lang.Object
org.springframework.data.redis.connection.RedisZSetCommands.Weights
- Enclosing interface:
- RedisZSetCommands
Value object encapsulating a multiplication factor for each input sorted set. This means that the score of every
element in every input sorted set is multiplied by this factor before being passed to the aggregation function.
- Since:
- 2.1
- Author:
- Mark Paluch, Christoph Strobl
-
Method Summary
Modifier and TypeMethodDescriptionCreates a newRedisZSetCommands.Weightsobject that contains all weights withFunctionapplied.booleanstatic RedisZSetCommands.WeightsfromSetCount(int count) Creates equalRedisZSetCommands.Weightsfor a number of input setscountwith a weight of one.doublegetWeight(int index) Retrieve the weight atindex.inthashCode()multiply(double multiplier) Creates a newRedisZSetCommands.Weightsobject that contains all weights multiplied bymultipliermultiply(int multiplier) Creates a newRedisZSetCommands.Weightsobject that contains all weights multiplied bymultiplierstatic RedisZSetCommands.Weightsof(double... weights) static RedisZSetCommands.Weightsof(int... weights) intsize()double[]toArray()toList()
-
Method Details
-
of
- Parameters:
weights- must not be null.- Returns:
- the
RedisZSetCommands.Weightsforweights.
-
of
- Parameters:
weights- must not be null.- Returns:
- the
RedisZSetCommands.Weightsforweights.
-
fromSetCount
Creates equalRedisZSetCommands.Weightsfor a number of input setscountwith a weight of one.- Parameters:
count- number of input sets. Must be greater or equal to zero.- Returns:
- equal
RedisZSetCommands.Weightsfor a number of input sets with a weight of one.
-
multiply
Creates a newRedisZSetCommands.Weightsobject that contains all weights multiplied bymultiplier- Parameters:
multiplier- multiplier used to multiply each weight with.- Returns:
- equal
RedisZSetCommands.Weightsfor a number of input sets with a weight of one.
-
multiply
Creates a newRedisZSetCommands.Weightsobject that contains all weights multiplied bymultiplier- Parameters:
multiplier- multiplier used to multiply each weight with.- Returns:
- equal
RedisZSetCommands.Weightsfor a number of input sets with a weight of one.
-
apply
Creates a newRedisZSetCommands.Weightsobject that contains all weights withFunctionapplied.- Parameters:
operator- operator function.- Returns:
- the new
RedisZSetCommands.WeightswithDoubleUnaryOperatorapplied.
-
getWeight
public double getWeight(int index) Retrieve the weight atindex.- Parameters:
index- the weight index.- Returns:
- the weight at
index. - Throws:
IndexOutOfBoundsException- if the index is out of range
-
size
public int size()- Returns:
- number of weights.
-
toArray
public double[] toArray()- Returns:
- an array containing all of the weights in this list in proper sequence (from first to last element).
-
toList
- Returns:
- a
Listcontaining all of the weights in this list in proper sequence (from first to last element).
-
equals
-
hashCode
public int hashCode()
-