Class NumericThreshold<E>

  • All Implemented Interfaces:
    BatchingThreshold<E>

    public final class NumericThreshold<E>
    extends java.lang.Object
    implements BatchingThreshold<E>
    A threshold which accumulates a count based on the provided ElementCounter.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void accumulate​(E e)
      Presents the element to the threshold for the attribute of interest to be accumulated.
      BatchingThreshold<E> copyWithZeroedValue()
      Make a copy of this threshold but with the accumulated value zeroed.
      boolean isThresholdReached()
      Any calls into this function from ThresholdBatcher will be under a lock.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NumericThreshold

        public NumericThreshold​(long threshold,
                                ElementCounter<E> extractor)
        Constructs a NumericThreshold.
        Parameters:
        threshold - The value that allows an event to happen.
        extractor - Object that extracts a numeric value from the value object.
    • Method Detail

      • accumulate

        public void accumulate​(E e)
        Description copied from interface: BatchingThreshold
        Presents the element to the threshold for the attribute of interest to be accumulated.

        Any calls into this function from ThresholdBatcher will be under a lock.

        Specified by:
        accumulate in interface BatchingThreshold<E>
      • isThresholdReached

        public boolean isThresholdReached()
        Description copied from interface: BatchingThreshold
        Any calls into this function from ThresholdBatcher will be under a lock.
        Specified by:
        isThresholdReached in interface BatchingThreshold<E>
        Returns:
        whether the threshold has been reached.