Domain
- the type of elements to be aggregated.Accumulator
- the type used to store the interim results of the aggregate computation,
that may be incrementally refreshed upon updates to the multiset, and that can easily yield the final result.AggregateResult
- the type of the final result of the aggregation to be output.public interface IMultisetAggregationOperator<Domain,Accumulator,AggregateResult>
The operator provides two methods of computation:
#aggregateStatelessly(Collection)
.createNeutral()
, update(Object, Object, boolean)
, isNeutral(Object)
, getAggregate(Object)
.
In case of incremental computation, the aggregable multiset is conceptual; it is not represented by an explicit Collection In case of incremental computation, internal results, potentially distinct from the final aggregate result, may be stored in a helper data structure called accumulator.
The goal of this distinction is that the final result may not be sufficient for incremental updates (see e.g. ExtremumOperator
).
Modifier and Type | Method and Description |
---|---|
AggregateResult |
aggregateStream(java.util.stream.Stream<Domain> stream)
Calculates the aggregate results from a given stream of values; all values are considered as inserted
|
default Accumulator |
clone(Accumulator original)
Clones the given accumulator (with all its internal contents).
|
default AggregateResult |
combine(AggregateResult left,
Accumulator right)
Combines the given aggregate result and accumulator into a single aggregate result.
|
default boolean |
contains(Domain value,
Accumulator accumulator) |
Accumulator |
createNeutral() |
AggregateResult |
getAggregate(Accumulator result) |
java.lang.String |
getName()
A name or identifier of the operator.
|
java.lang.String |
getShortDescription()
A textual description of the operator.
|
boolean |
isNeutral(Accumulator result) |
default java.lang.String |
prettyPrint(Accumulator accumulator)
Pretty prints the contents of the given accumulator.
|
Accumulator |
update(Accumulator oldResult,
Domain updateValue,
boolean isInsertion) |
java.lang.String getShortDescription()
java.lang.String getName()
Accumulator createNeutral()
boolean isNeutral(Accumulator result)
Accumulator update(Accumulator oldResult, Domain updateValue, boolean isInsertion)
AggregateResult getAggregate(Accumulator result)
AggregateResult aggregateStream(java.util.stream.Stream<Domain> stream)
default Accumulator clone(Accumulator original)
default AggregateResult combine(AggregateResult left, Accumulator right)
default boolean contains(Domain value, Accumulator accumulator)
default java.lang.String prettyPrint(Accumulator accumulator)