Class AccumulatorSink

java.lang.Object
nz.org.riskscape.engine.sched.AccumulatorSink
All Implemented Interfaces:
nz.org.riskscape.engine.pipeline.Sink

public class AccumulatorSink extends Object implements nz.org.riskscape.engine.pipeline.Sink

An unbounded Sink that receives results for accumulation, intended for use at the end of a ChainTask where a chain can feed multiple groupings, or, in a standalone SinkTask where usually (so far) a single collection is fed from something other than a chain - perhaps another grouping.

  • Constructor Details

    • AccumulatorSink

      public AccumulatorSink(List<nz.org.riskscape.engine.pipeline.Collector<?>> collectors)
  • Method Details

    • accept

      public boolean accept(nz.org.riskscape.engine.Tuple tuple)
      Specified by:
      accept in interface nz.org.riskscape.engine.pipeline.Sink
    • getAndClearAccumulator

      public Object getAndClearAccumulator(nz.org.riskscape.engine.pipeline.Collector forCollector)

      Returns the accumulator for a given collector. This clears the accumulator for the sink (so that any tuples associated with the accumulator can eventually be garbage collected), so should only be called when the sink is finished.

    • finish

      public void finish()
      Specified by:
      finish in interface nz.org.riskscape.engine.pipeline.Sink
    • isUnbounded

      public boolean isUnbounded()
      Specified by:
      isUnbounded in interface nz.org.riskscape.engine.pipeline.Sink
    • canAccept

      public boolean canAccept()
      Specified by:
      canAccept in interface nz.org.riskscape.engine.pipeline.Sink