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 TypeMethodDescriptionbooleanstatic WeightsfromSetCount(int count) Creates equalWeightsfor a number of input setscountwith a weight of one.doublegetWeight(int index) Retrieve the weight atindex.inthashCode()multiply(double multiplier) Creates a newWeightsobject that contains all weights multiplied bymultipliermultiply(int multiplier) Creates a newWeightsobject that contains all weights multiplied bymultiplierstatic Weightsof(double... weights) static Weightsof(int... weights) intsize()double[]toArray()toList()
-
Method Details
-
of
- Parameters:
weights- must not be null.- Returns:
- the
Weightsforweights.
-
of
- Parameters:
weights- must not be null.- Returns:
- the
Weightsforweights.
-
fromSetCount
Creates equalWeightsfor a number of input setscountwith a weight of one.- Parameters:
count- number of input sets. Must be greater or equal to zero.- Returns:
- equal
Weightsfor a number of input sets with a weight of one.
-
multiply
Creates a newWeightsobject that contains all weights multiplied bymultiplier- Parameters:
multiplier- multiplier used to multiply each weight with.- Returns:
- equal
Weightsfor a number of input sets with a weight of one.
-
multiply
Creates a newWeightsobject that contains all weights multiplied bymultiplier- Parameters:
multiplier- multiplier used to multiply each weight with.- Returns:
- equal
Weightsfor a number of input sets with a weight of one.
-
apply
- Parameters:
operator- operator function.- Returns:
- the new
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()
-