Package org.apache.juneau.utils
Class WeightedAverage
java.lang.Object
org.apache.juneau.utils.WeightedAverage
A simple weighted average of numbers.
See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd a number with a weight to this average.double
getValue()
Returns the weighted average of all numbers.
-
Constructor Details
-
WeightedAverage
public WeightedAverage()
-
-
Method Details
-
add
Add a number with a weight to this average.- Parameters:
w
- The weight of the new value.v
- The new value.- Returns:
- This object.
-
getValue
Returns the weighted average of all numbers.- Returns:
- The weighted average of all numbers.
-