Interface IMultisetAggregationOperator<Domain,Accumulator,AggregateResult>

Type Parameters:
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.
All Known Implementing Classes:
AbstractMemorylessAggregationOperator, DoubleAverageOperator, DoubleSumOperator, ExtremumOperator, IntegerAverageOperator, IntegerSumOperator, LongAverageOperator, LongSumOperator

public interface IMultisetAggregationOperator<Domain,Accumulator,AggregateResult>
A single column aggregator is used to incrementally compute the aggregate of a multiset of values according to an aggregator operator.

The operator provides two methods of computation:

In case of incremental computation, the aggregable multiset is conceptual; it is not represented by an explicit Collection object, but its update operations are tracked.

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).

Since:
1.4
  • Method Details

    • getShortDescription

      String getShortDescription()
      A textual description of the operator.
    • getName

      String getName()
      A name or identifier of the operator.
    • createNeutral

      Accumulator createNeutral()
      Returns:
      the neutral element, i.e. the interim result of aggregating an empty multiset.
    • isNeutral

      boolean isNeutral(Accumulator result)
      Returns:
      true if the interim result is equivalent to the neutral element, as if there are no values in the multiset. Must return true if the multiset is empty.
    • update

      Accumulator update(Accumulator oldResult, Domain updateValue, boolean isInsertion)
      Returns:
      an updated intermediate result, changed to reflect that a given object was added to / removed from the multiset (as indicated by the parameter isInsertion)
    • getAggregate

      AggregateResult getAggregate(Accumulator result)
      Returns:
      the aggregate result obtained from the given intermediate result. May be null to indicate that the current multiset cannot be aggregated (e.g. 0 elements have no minimum).
    • aggregateStream

      AggregateResult aggregateStream(Stream<Domain> stream)
      Calculates the aggregate results from a given stream of values; all values are considered as inserted
      Returns:
      the aggregate result, or null if no result can be calculated (e.g. because of an empty stream)
      Since:
      2.0
    • clone

      default Accumulator clone(Accumulator original)
      Clones the given accumulator (with all its internal contents).
    • combine

      default AggregateResult combine(AggregateResult left, Accumulator right)
      Combines the given aggregate result and accumulator into a single aggregate result.
    • contains

      default boolean contains(Domain value, Accumulator accumulator)
    • prettyPrint

      default String prettyPrint(Accumulator accumulator)
      Pretty prints the contents of the given accumulator.