Interface StreamingCollector<T>

All Superinterfaces:
AutoCloseable, Realized

public interface StreamingCollector<T> extends Realized
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    accumulate(T accumulator, Tuple tuple)
    Give a tuple to the accumulator for accumulation.
    combine(T lhs, T rhs)
    Combine two accumulators, returning an accumulator that contains the accumulated state of both.
    The type of tuple this collector accepts.
    The type of tuple this collector produces
    Create a new accumulator that holds collection/aggregation state for this collector to use.
    process(T accumulator)
    Convert an accumulator in to a set of results.

    Methods inherited from interface nz.org.riskscape.engine.pipeline.Realized

    close
  • Method Details

    • getSourceType

      Struct getSourceType()

      The type of tuple this collector accepts.

    • getTargetType

      Struct getTargetType()

      The type of tuple this collector produces

    • newAccumulator

      T newAccumulator()

      Create a new accumulator that holds collection/aggregation state for this collector to use. These don't need to be thread safe - any code making use of this API should assume they'll be accessed by only a single thread. NB do we want to support a shared accumulator API?

    • accumulate

      boolean accumulate(T accumulator, Tuple tuple)

      Give a tuple to the accumulator for accumulation. This should add any required state to the accumulator for this tuple, for example add a number to a running total, append an element to a list, etc.

    • combine

      T combine(T lhs, T rhs)

      Combine two accumulators, returning an accumulator that contains the accumulated state of both. This needs to be done in such a way that it produces the same result as if only one accumulator is used. Implementations are free to modify and return one of the given accumulators if it makes sense.

    • process

      TupleIterator process(T accumulator)

      Convert an accumulator in to a set of results. This can be done lazily, e.g. rows can be pulled from the accumulator on demand.