public class WeightedNumberAverager extends AbstractCloneableSerializable implements Summarizer<WeightedValue<? extends java.lang.Number>,java.lang.Double>
Modifier and Type | Field and Description |
---|---|
static WeightedNumberAverager |
INSTANCE
Instance of WeightedNumberAverager, since it has no state.
|
Constructor and Description |
---|
WeightedNumberAverager()
Creates a new WeightedNumberAverager
|
Modifier and Type | Method and Description |
---|---|
java.lang.Double |
summarize(java.util.Collection<? extends WeightedValue<? extends java.lang.Number>> data)
Creates a summary of the given collection of data.
|
static double |
weightedAverage(java.lang.Iterable<? extends WeightedValue<? extends java.lang.Number>> data)
Computes the weighted average of the given data.
|
clone
public static final WeightedNumberAverager INSTANCE
public WeightedNumberAverager()
public java.lang.Double summarize(java.util.Collection<? extends WeightedValue<? extends java.lang.Number>> data)
Summarizer
summarize
in interface Summarizer<WeightedValue<? extends java.lang.Number>,java.lang.Double>
data
- The collection of data to summarize.public static double weightedAverage(java.lang.Iterable<? extends WeightedValue<? extends java.lang.Number>> data)
data
- The collection of weighted values of numbers to compute the
weighted average over.