Interface IItemConsumer<C>

  • Type Parameters:
    C - should always be <C extends IItemConsumer<C>> because we want to be able to merge multiple consumers of the same type
    All Known Implementing Classes:
    Aggregators.AdvancedMinMaxConsumer, Aggregators.AvgConsumer, Aggregators.CountConsumer, Aggregators.MinMaxConsumer, Aggregators.SetConsumer, Aggregators.VarianceConsumer

    public interface IItemConsumer<C>
    A mutable container that collects data from multiple items. Item consumers are not expected to be thread safe.

    Large data sets may be divided into multiple parts. Each part can then be processed in parallel by a separate IItemConsumer instance and when they are done the end result can be gotten by merging the consumers.

    Note that there is no defined way to extract the calculated value. This can be added by also implementing the IValueBuilder interface.

    • Method Detail

      • consume

        void consume​(IItem item)
        Consumes another item.
      • merge

        C merge​(C other)
        Merges this object with the supplied object. Normally this is another item consumer of the same type and the output result is a consumer with an internal state that reflects the state of both the current consumer and the input value.
        Parameters:
        other - another instance to merge with
        Returns:
        the merged instance