Class Weights
java.lang.Object
org.springframework.data.redis.connection.zset.Weights
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 TypeMethodDescriptionboolean
static Weights
fromSetCount
(int count) Creates equalWeights
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 newWeights
object that contains all weights multiplied bymultiplier
multiply
(int multiplier) Creates a newWeights
object that contains all weights multiplied bymultiplier
static Weights
of
(double... weights) static Weights
of
(int... weights) int
size()
double[]
toArray()
toList()
-
Method Details
-
of
- Parameters:
weights
- must not be null.- Returns:
- the
Weights
forweights
.
-
of
- Parameters:
weights
- must not be null.- Returns:
- the
Weights
forweights
.
-
fromSetCount
Creates equalWeights
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
Weights
for a number of input sets with a weight of one.
-
multiply
Creates a newWeights
object that contains all weights multiplied bymultiplier
- Parameters:
multiplier
- multiplier used to multiply each weight with.- Returns:
- equal
Weights
for a number of input sets with a weight of one.
-
multiply
Creates a newWeights
object that contains all weights multiplied bymultiplier
- Parameters:
multiplier
- multiplier used to multiply each weight with.- Returns:
- equal
Weights
for a number of input sets with a weight of one.
-
apply
- Parameters:
operator
- operator function.- Returns:
- the new
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()
-