public class Statistics
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
Statistics.Function<Input,Output>
generic function with a single input and a single output parameter
|
static interface |
Statistics.Predicate<Input>
generic function that maps a single value to a boolean
|
Constructor and Description |
---|
Statistics() |
Modifier and Type | Method and Description |
---|---|
static <Key,Value> |
asConditionalStatistic(UnweightedSampleCollector<Value> stat)
wraps an
UnweightedSampleCollector so that it implements the interface
ConditionalUnweightedStatistic . |
static <Key,Value,Weight> |
asConditionalStatistic(WeightedSampleCollector<Value,Weight> stat)
wraps a
WeightedSampleCollector so that it implements the interface
ConditionalWeightedStatistic . |
static <Key,Value,Weight> |
asWeightedStatistic(ConditionalUnweightedStatistic<Key,Value> stat)
wraps an
UnweightedSampleCollector , so that it accepts a weight but
ignores it |
static <Value,Weight> |
asWeightedStatistic(UnweightedSampleCollector<Value> stat)
wraps an
UnweightedSampleCollector , so that it accepts a weight but
ignores it |
static <Key,Value> |
combine(ConditionalUnweightedStatistic<? super Key,? super Value>... stats)
combines multiple
ConditionalUnweightedStatistic instances. |
static <Key,Value,Weight> |
combine(ConditionalWeightedStatistic<? super Key,? super Value,? super Weight>... stats)
combines multiple
ConditionalWeightedStatistic instances. |
static <Value> UnweightedSampleCollector<Value> |
combine(UnweightedSampleCollector<? super Value>... stats)
combines multiple
UnweightedSampleCollector instances. |
static <Value,Weight> |
combine(WeightedSampleCollector<? super Value,? super Weight>... stats)
combines multiple
WeightedSampleCollector instances. |
static <Key,Value> |
combineCondUnweighted(java.util.Collection<ConditionalUnweightedStatistic<? super Key,? super Value>> stats)
combines multiple
ConditionalUnweightedStatistic instances. |
static <Key,Value,Weight> |
combineCondWeighted(java.util.Collection<ConditionalWeightedStatistic<? super Key,? super Value,? super Weight>> stats)
combines multiple
ConditionalWeightedStatistic instances. |
static <Value> UnweightedSampleCollector<Value> |
combineUnweighted(java.util.Collection<UnweightedSampleCollector<? super Value>> stats)
combines multiple
UnweightedSampleCollector instances. |
static <Value,Weight> |
combineWeighted(java.util.Collection<WeightedSampleCollector<? super Value,? super Weight>> stats)
combines multiple
WeightedSampleCollector instances. |
static <Key,Value> |
filter(ConditionalUnweightedStatistic<Key,Value> stat,
Statistics.Predicate<Value> filterFunction)
Wraps a
ConditionalUnweightedStatistic , so that calls to the
update() method are only executed when the filterFunction returns true. |
static <Key,Value,Weight> |
filter(ConditionalWeightedStatistic<Key,Value,Weight> stat,
Statistics.Predicate<Value> filterFunction)
Wraps a
ConditionalWeightedStatistic , so that calls to the
update() method are only executed when the filterFunction returns true. |
static <Value> UnweightedSampleCollector<Value> |
filter(UnweightedSampleCollector<Value> stat,
Statistics.Predicate<Value> filterFunction)
Wraps an
UnweightedSampleCollector , so that calls to the update() method
are only executed when the filterFunction returns true. |
static <Value,Weight> |
filter(WeightedSampleCollector<Value,Weight> stat,
Statistics.Predicate<Value> filterFunction)
Wraps a
WeightedSampleCollector , so that calls to the update() method
are only executed when the filterFunction returns true. |
static <Key,Value> |
filterByKey(ConditionalUnweightedStatistic<Key,Value> stat,
Statistics.Predicate<Key> filterFunction)
Wraps a
ConditionalUnweightedStatistic , so that calls to the
update() method are only executed when the filterFunction returns true. |
static <Key,Value,Weight> |
filterByKey(ConditionalWeightedStatistic<Key,Value,Weight> stat,
Statistics.Predicate<Key> filterFunction)
Wraps a
ConditionalWeightedStatistic , so that calls to the
update() method are only executed when the filterFunction returns true. |
static <Key,Value,Weight> |
filterByWeight(ConditionalWeightedStatistic<Key,Value,Weight> stat,
Statistics.Predicate<Weight> filterFunction)
Wraps a
ConditionalWeightedStatistic , so that calls to the
update() method are only executed when the filterFunction returns true. |
static <Value,Weight> |
filterByWeight(WeightedSampleCollector<Value,Weight> stat,
Statistics.Predicate<Weight> filterFunction)
Wraps a
WeightedSampleCollector , so that calls to the update() method
are only executed when the filterFunction returns true. |
static <Value> UnweightedSampleCollector<Value> |
ignoreValue(UnweightedSampleCollector<java.lang.Void> stat)
wraps a
UnweightedSampleCollector which accepts no values, so that it
accepts any values but ignores those |
static <Key,Input,Output> |
map(ConditionalUnweightedStatistic<Key,Output> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
ConditionalUnweightedStatistic which accepts values of
type O , so that the result accepts values of type
I . |
static <Key,Input,Weight,Output> |
map(ConditionalWeightedStatistic<Key,Output,Weight> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
ConditionalWeightedStatistic which accepts values of type
O , so that the result accepts values of type I . |
static <Input,Key,Value,Weight> |
map(ConditionalWeightedStatistic<Key,Value,Weight> stat,
Statistics.Function<Input,Key> keyMapping,
Statistics.Function<Input,Value> valueMapping,
Statistics.Function<Input,Weight> weightMapping)
Wraps a
ConditionalWeightedStatistic , so that the result is an
UnweightedSampleCollector . |
static <Input,Output> |
map(UnweightedSampleCollector<Output> stat,
Statistics.Function<Input,Output> mapping)
Wraps an
UnweightedSampleCollector which accepts values of type
O , so that the result accepts values of type I . |
static <Input,Output,Weight> |
map(WeightedSampleCollector<Output,Weight> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
WeightedSampleCollector which accepts values of type
O , so that the result accepts values of type I . |
static <Input,Value,Weight> |
map(WeightedSampleCollector<Value,Weight> stat,
Statistics.Function<Input,Value> valueMapping,
Statistics.Function<Input,Weight> weightMapping)
Wraps a
WeightedSampleCollector which accepts values of type
V and weights of type W , so that the result is
an unweighted statistic which accepts values of type I . |
static <Input,Value,Output> |
mapKey(ConditionalUnweightedStatistic<Output,Value> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
ConditionalUnweightedStatistic which accepts keys of type
O , so that the result accepts keys of type I . |
static <Input,Value,Weight,Output> |
mapKey(ConditionalWeightedStatistic<Output,Value,Weight> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
ConditionalWeightedStatistic which accepts keys of type
O , so that the result accepts keys of type I . |
static <Key,Value,Input,Output> |
mapWeight(ConditionalWeightedStatistic<Key,Value,Output> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
ConditionalWeightedStatistic which accepts weights of type
O , so that the result accepts weights of type I . |
static <Input,Output,Value> |
mapWeight(WeightedSampleCollector<Value,Output> stat,
Statistics.Function<Input,Output> mapping)
Wraps a
WeightedSampleCollector which accepts weights of type
O , so that the result accepts weights of type I . |
static <Value> UnweightedSampleCollector<Value> |
weightOneDouble(WeightedSampleCollector<Value,java.lang.Double> stat)
wraps a
WeightedSampleCollector with weight of type double, so that it
implements the interface UnweightedSampleCollector . |
static <Value> UnweightedSampleCollector<Value> |
weightOneLong(WeightedSampleCollector<Value,java.lang.Long> stat)
wraps a
WeightedSampleCollector with weight of type long, so that it
implements the interface UnweightedSampleCollector . |
static <Value> WeightedSampleCollector<Value,java.lang.Long> |
weightToMultipleCalls(UnweightedSampleCollector<Value> stat)
wraps an
UnweightedSampleCollector , so that it accepts a weight. |
public static <Value> UnweightedSampleCollector<Value> ignoreValue(UnweightedSampleCollector<java.lang.Void> stat)
UnweightedSampleCollector
which accepts no values, so that it
accepts any values but ignores thosepublic static <Value,Weight> WeightedSampleCollector<Value,Weight> asWeightedStatistic(UnweightedSampleCollector<Value> stat)
UnweightedSampleCollector
, so that it accepts a weight but
ignores itpublic static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> asWeightedStatistic(ConditionalUnweightedStatistic<Key,Value> stat)
UnweightedSampleCollector
, so that it accepts a weight but
ignores itpublic static <Key,Value> ConditionalUnweightedStatistic<Key,Value> asConditionalStatistic(UnweightedSampleCollector<Value> stat)
UnweightedSampleCollector
so that it implements the interface
ConditionalUnweightedStatistic
. Each time the method
update()
is called, the key is ignored and the method
update()
of the UnweightedSampleCollector
is called with
the value.public static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> asConditionalStatistic(WeightedSampleCollector<Value,Weight> stat)
WeightedSampleCollector
so that it implements the interface
ConditionalWeightedStatistic
. Each time the method
update()
is called, the key is ignored and the method
update()
of the WeightedSampleCollector
is called with the
value and the weight.public static <Value> UnweightedSampleCollector<Value> weightOneLong(WeightedSampleCollector<Value,java.lang.Long> stat)
WeightedSampleCollector
with weight of type long, so that it
implements the interface UnweightedSampleCollector
. Each time the method
update()
is called, the method update()
of the
wrapped statistic is called with a weight set to one.public static <Value> UnweightedSampleCollector<Value> weightOneDouble(WeightedSampleCollector<Value,java.lang.Double> stat)
WeightedSampleCollector
with weight of type double, so that it
implements the interface UnweightedSampleCollector
. Each time the method
update()
is called, the method update()
of the
wrapped statistic is called with a weight set to one.public static <Value> WeightedSampleCollector<Value,java.lang.Long> weightToMultipleCalls(UnweightedSampleCollector<Value> stat)
UnweightedSampleCollector
, so that it accepts a weight. The
weight is converted to multiple calls of the update()
method
of the base statistic.public static <Value> UnweightedSampleCollector<Value> combineUnweighted(java.util.Collection<UnweightedSampleCollector<? super Value>> stats)
UnweightedSampleCollector
instances. Each time the
method update()
of the wrapping statistic is called, the
update()
methods of each of the wrapped statistics is called
with the same value.@SafeVarargs public static <Value> UnweightedSampleCollector<Value> combine(UnweightedSampleCollector<? super Value>... stats)
UnweightedSampleCollector
instances. Each time the
method update()
of the wrapping statistic is called, the
update()
methods of each of the wrapped statistics is called
with the same value.public static <Value,Weight> WeightedSampleCollector<Value,Weight> combineWeighted(java.util.Collection<WeightedSampleCollector<? super Value,? super Weight>> stats)
WeightedSampleCollector
instances. Each time the
method update()
of the wrapping statistic is called, the
update()
methods of each of the wrapped statistics is called
with the same value and weight.@SafeVarargs public static <Value,Weight> WeightedSampleCollector<Value,Weight> combine(WeightedSampleCollector<? super Value,? super Weight>... stats)
WeightedSampleCollector
instances. Each time the
method update()
of the wrapping statistic is called, the
update()
methods of each of the wrapped statistics is called
with the same value and weight.public static <Key,Value> ConditionalUnweightedStatistic<Key,Value> combineCondUnweighted(java.util.Collection<ConditionalUnweightedStatistic<? super Key,? super Value>> stats)
ConditionalUnweightedStatistic
instances. Each
time the method update()
of the wrapping statistic is called,
the update()
methods of each of the wrapped statistics is
called with the same key and value.@SafeVarargs public static <Key,Value> ConditionalUnweightedStatistic<Key,Value> combine(ConditionalUnweightedStatistic<? super Key,? super Value>... stats)
ConditionalUnweightedStatistic
instances. Each
time the method update()
of the wrapping statistic is called,
the update()
methods of each of the wrapped statistics is
called with the same key and value.public static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> combineCondWeighted(java.util.Collection<ConditionalWeightedStatistic<? super Key,? super Value,? super Weight>> stats)
ConditionalWeightedStatistic
instances. Each
time the method update()
of the wrapping statistic is called,
the update()
methods of each of the wrapped statistics is
called with the same key, value, and weight.@SafeVarargs public static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> combine(ConditionalWeightedStatistic<? super Key,? super Value,? super Weight>... stats)
ConditionalWeightedStatistic
instances. Each
time the method update()
of the wrapping statistic is called,
the update()
methods of each of the wrapped statistics is
called with the same key, value, and weight.public static <Input,Output> UnweightedSampleCollector<Input> map(UnweightedSampleCollector<Output> stat, Statistics.Function<Input,Output> mapping)
UnweightedSampleCollector
which accepts values of type
O
, so that the result accepts values of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each value.public static <Input,Value,Weight> UnweightedSampleCollector<Input> map(WeightedSampleCollector<Value,Weight> stat, Statistics.Function<Input,Value> valueMapping, Statistics.Function<Input,Weight> weightMapping)
WeightedSampleCollector
which accepts values of type
V
and weights of type W
, so that the result is
an unweighted statistic which accepts values of type I
. The
first mapping function has the input type I
and the output
type V
. It is used to convert each value. The second mapping
function (types I
, W
) is used to map the input
to the weight.public static <Input,Output,Weight> WeightedSampleCollector<Input,Weight> map(WeightedSampleCollector<Output,Weight> stat, Statistics.Function<Input,Output> mapping)
WeightedSampleCollector
which accepts values of type
O
, so that the result accepts values of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each value. The weight
is not mapped.public static <Input,Output,Value> WeightedSampleCollector<Value,Input> mapWeight(WeightedSampleCollector<Value,Output> stat, Statistics.Function<Input,Output> mapping)
WeightedSampleCollector
which accepts weights of type
O
, so that the result accepts weights of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each weight. The value
is not mapped.
It is not allowed to use the update() method without weight any more. In case it is used, a runtime exception is thrown.
public static <Key,Input,Output> ConditionalUnweightedStatistic<Key,Input> map(ConditionalUnweightedStatistic<Key,Output> stat, Statistics.Function<Input,Output> mapping)
ConditionalUnweightedStatistic
which accepts values of
type O
, so that the result accepts values of type
I
. The specified mapping function has the input type
I
and the output type O
. It is used to convert
each value. The key is not mapped.public static <Input,Value,Output> ConditionalUnweightedStatistic<Input,Value> mapKey(ConditionalUnweightedStatistic<Output,Value> stat, Statistics.Function<Input,Output> mapping)
ConditionalUnweightedStatistic
which accepts keys of type
O
, so that the result accepts keys of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each key. The value is
not mapped.public static <Key,Input,Weight,Output> ConditionalWeightedStatistic<Key,Input,Weight> map(ConditionalWeightedStatistic<Key,Output,Weight> stat, Statistics.Function<Input,Output> mapping)
ConditionalWeightedStatistic
which accepts values of type
O
, so that the result accepts values of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each value. The key and
the weight are not mapped.public static <Input,Value,Weight,Output> ConditionalWeightedStatistic<Input,Value,Weight> mapKey(ConditionalWeightedStatistic<Output,Value,Weight> stat, Statistics.Function<Input,Output> mapping)
ConditionalWeightedStatistic
which accepts keys of type
O
, so that the result accepts keys of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each key. The value and
the weight are not mapped.public static <Key,Value,Input,Output> ConditionalWeightedStatistic<Key,Value,Input> mapWeight(ConditionalWeightedStatistic<Key,Value,Output> stat, Statistics.Function<Input,Output> mapping)
ConditionalWeightedStatistic
which accepts weights of type
O
, so that the result accepts weights of type I
.
The specified mapping function has the input type I
and the
output type O
. It is used to convert each weight. The key and
the value are not mapped.public static <Input,Key,Value,Weight> UnweightedSampleCollector<Input> map(ConditionalWeightedStatistic<Key,Value,Weight> stat, Statistics.Function<Input,Key> keyMapping, Statistics.Function<Input,Value> valueMapping, Statistics.Function<Input,Weight> weightMapping)
ConditionalWeightedStatistic
, so that the result is an
UnweightedSampleCollector
. Key, value, and weight of the wrapped
statistics are generated from the single input value of the
UnweightedSampleCollector
by three different functions.public static <Value> UnweightedSampleCollector<Value> filter(UnweightedSampleCollector<Value> stat, Statistics.Predicate<Value> filterFunction)
UnweightedSampleCollector
, so that calls to the update() method
are only executed when the filterFunction returns true. The output of the
filterFunction is a function of the value.public static <Value,Weight> WeightedSampleCollector<Value,Weight> filter(WeightedSampleCollector<Value,Weight> stat, Statistics.Predicate<Value> filterFunction)
WeightedSampleCollector
, so that calls to the update() method
are only executed when the filterFunction returns true. The output of the
filterFunction is a function of the value.public static <Value,Weight> WeightedSampleCollector<Value,Weight> filterByWeight(WeightedSampleCollector<Value,Weight> stat, Statistics.Predicate<Weight> filterFunction)
WeightedSampleCollector
, so that calls to the update() method
are only executed when the filterFunction returns true. The output of the
filterFunction is a function of the weight.
It is not allowed to use the update() method without weight any more. In case it is used, a runtime exception is thrown.
public static <Key,Value> ConditionalUnweightedStatistic<Key,Value> filter(ConditionalUnweightedStatistic<Key,Value> stat, Statistics.Predicate<Value> filterFunction)
ConditionalUnweightedStatistic
, so that calls to the
update() method are only executed when the filterFunction returns true.
The output of the filterFunction is a function of the value.public static <Key,Value> ConditionalUnweightedStatistic<Key,Value> filterByKey(ConditionalUnweightedStatistic<Key,Value> stat, Statistics.Predicate<Key> filterFunction)
ConditionalUnweightedStatistic
, so that calls to the
update() method are only executed when the filterFunction returns true.
The output of the filterFunction is a function of the key.public static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> filter(ConditionalWeightedStatistic<Key,Value,Weight> stat, Statistics.Predicate<Value> filterFunction)
ConditionalWeightedStatistic
, so that calls to the
update() method are only executed when the filterFunction returns true.
The output of the filterFunction is a function of the value.public static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> filterByWeight(ConditionalWeightedStatistic<Key,Value,Weight> stat, Statistics.Predicate<Weight> filterFunction)
ConditionalWeightedStatistic
, so that calls to the
update() method are only executed when the filterFunction returns true.
The output of the filterFunction is a function of the weight.public static <Key,Value,Weight> ConditionalWeightedStatistic<Key,Value,Weight> filterByKey(ConditionalWeightedStatistic<Key,Value,Weight> stat, Statistics.Predicate<Key> filterFunction)
ConditionalWeightedStatistic
, so that calls to the
update() method are only executed when the filterFunction returns true.
The output of the filterFunction is a function of the key.