Class NumericThreshold<E>

  • All Implemented Interfaces:
    BatchingThreshold<E>

    public final class NumericThreshold<E>
    extends Object
    implements BatchingThreshold<E>
    A threshold which accumulates a count based on the provided ElementCounter.
    • 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.