InputT - the type of input valuesAccumT - the type of accumulator valuesOutputT - the type of output valuepublic class CounterAggregator<InputT,AccumT,OutputT> extends Object implements Aggregator<InputT,OutputT>
Aggregator interface that uses a
Counter as the underlying representation. Supports Combine.CombineFns
from the Sum, Min and Max classes.| Constructor and Description |
|---|
CounterAggregator(String name,
Combine.CombineFn<? super InputT,AccumT,OutputT> combiner,
CounterSet.AddCounterMutator addCounterMutator)
Constructs a new aggregator with the given name and aggregation logic
specified in the CombineFn argument.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addValue(InputT value)
Adds a new value into the Aggregator.
|
Combine.CombineFn<InputT,?,OutputT> |
getCombineFn()
Returns the
Combine.CombineFn, which combines input elements in the
aggregator. |
String |
getName()
Returns the name of the Aggregator.
|
public CounterAggregator(String name, Combine.CombineFn<? super InputT,AccumT,OutputT> combiner, CounterSet.AddCounterMutator addCounterMutator)
If a counter with the same name already exists, it will be reused, as long as it has the same type.
public void addValue(InputT value)
AggregatoraddValue in interface Aggregator<InputT,OutputT>public String getName()
AggregatorgetName in interface Aggregator<InputT,OutputT>public Combine.CombineFn<InputT,?,OutputT> getCombineFn()
AggregatorCombine.CombineFn, which combines input elements in the
aggregator.getCombineFn in interface Aggregator<InputT,OutputT>