Class LogarithmicIterator

  • All Implemented Interfaces:
    Iterator<HistogramIterationValue>

    public class LogarithmicIterator
    extends Object
    implements Iterator<HistogramIterationValue>
    Used for iterating through histogram values in logarithmically increasing levels. The iteration is performed in steps that start at valueUnitsInFirstBucket and increase exponentially according to logBase, terminating when all recorded histogram values are exhausted. Note that each iteration "bucket" includes values up to and including the next bucket boundary value.
    • Constructor Detail

      • LogarithmicIterator

        public LogarithmicIterator​(AbstractHistogram histogram,
                                   long valueUnitsInFirstBucket,
                                   double logBase)
        Parameters:
        histogram - The histogram this iterator will operate on
        valueUnitsInFirstBucket - the size (in value units) of the first value bucket step
        logBase - the multiplier by which the bucket size is expanded in each iteration step.
    • Method Detail

      • reset

        public void reset​(long valueUnitsInFirstBucket,
                          double logBase)
        Reset iterator for re-use in a fresh iteration over the same histogram data set.
        Parameters:
        valueUnitsInFirstBucket - the size (in value units) of the first value bucket step
        logBase - the multiplier by which the bucket size is expanded in each iteration step.
      • hasNext

        public boolean hasNext()
        Returns true if the iteration has more elements. (In other words, returns true if next would return an element rather than throwing an exception.)
        Specified by:
        hasNext in interface Iterator<HistogramIterationValue>
        Returns:
        true if the iterator has more elements.