Class StatefulAccumulator<T,​O>

java.lang.Object
org.vanted.indexednodes.accumulators.StatefulAccumulator<T,​O>
Type Parameters:
T -
O -
All Implemented Interfaces:
Consumer<O>
Direct Known Subclasses:
DistanceAccumulator, EdgeCountAccumulator, IndexedEdgeListAccumulator, IndexedNodeSetAccumulator, NodeCountAccumulator

public abstract class StatefulAccumulator<T,​O>
extends Object
implements Consumer<O>
An object that holds an accumulating value of type T and is able to accept parameters of type O and (potentially) aggregate them into a value of type T.
Since:
2.8
Author:
Benjamin Moser
  • Constructor Details

    • StatefulAccumulator

      public StatefulAccumulator​(T init)
  • Method Details

    • apply

      public void apply​(O value)
      Interface method to apply a value to the accumulator, additionally calling the next accumulator if set.
      Parameters:
      value -
    • then

      public StatefulAccumulator<T,​O> then​(StatefulAccumulator<?,​O> next)
      Compose with another accumulator
      Parameters:
      next -
      Returns:
    • get

      public T get()