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.Weights
object that contains all weights withFunction
applied.boolean
static RedisZSetCommands.Weights
fromSetCount
(int count) Creates equalRedisZSetCommands.Weights
for a number of input setscount
with a weight of one.double
getWeight
(int index) Retrieve the weight atindex
.int
hashCode()
multiply
(double multiplier) Creates a newRedisZSetCommands.Weights
object that contains all weights multiplied bymultiplier
multiply
(int multiplier) Creates a newRedisZSetCommands.Weights
object that contains all weights multiplied bymultiplier
static RedisZSetCommands.Weights
of
(double... weights) static RedisZSetCommands.Weights
of
(int... weights) int
size()
double[]
toArray()
toList()
-
Method Details
-
of
- Parameters:
weights
- must not be null.- Returns:
- the
RedisZSetCommands.Weights
forweights
.
-
of
- Parameters:
weights
- must not be null.- Returns:
- the
RedisZSetCommands.Weights
forweights
.
-
fromSetCount
Creates equalRedisZSetCommands.Weights
for a number of input setscount
with a weight of one.- Parameters:
count
- number of input sets. Must be greater or equal to zero.- Returns:
- equal
RedisZSetCommands.Weights
for a number of input sets with a weight of one.
-
multiply
Creates a newRedisZSetCommands.Weights
object that contains all weights multiplied bymultiplier
- Parameters:
multiplier
- multiplier used to multiply each weight with.- Returns:
- equal
RedisZSetCommands.Weights
for a number of input sets with a weight of one.
-
multiply
Creates a newRedisZSetCommands.Weights
object that contains all weights multiplied bymultiplier
- Parameters:
multiplier
- multiplier used to multiply each weight with.- Returns:
- equal
RedisZSetCommands.Weights
for a number of input sets with a weight of one.
-
apply
Creates a newRedisZSetCommands.Weights
object that contains all weights withFunction
applied.- Parameters:
operator
- operator function.- Returns:
- the new
RedisZSetCommands.Weights
withDoubleUnaryOperator
applied.
-
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
List
containing all of the weights in this list in proper sequence (from first to last element).
-
equals
-
hashCode
public int hashCode()
-