Class BoundedHistogram


  • public final class BoundedHistogram
    extends java.lang.Object
    A simple, exact histogram implementation that is used for small domain spaces. It's main purpose is tracking statistics for compression related logic. If no values are recorded the returned values are undefined.
    • Constructor Summary

      Constructors 
      Constructor Description
      BoundedHistogram​(int upperBoundInclusive)
      Creates a histogram that accepts values in [0, upperBoundInclusive].
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(BoundedHistogram other)
      Adds all recorded values of `other` to `this` histogram.
      long frequency​(int value)
      Returns the number of recordings for the given value.
      int max()
      Returns the highest recorded value in the histogram.
      double mean()
      Return the average value recorded.
      int median()
      Return the median value recorded.
      int min()
      Returns the lowest recorded value in the histogram.
      int percentile​(float percentile)
      Return the value that `percentile` percent of all values fall below.
      void record​(int value)
      Record the occurrence of the value in the histogram.
      void reset()
      Reset the recorded values within the histogram.
      double stdDev()
      Return the standard deviation across all values.
      long total()
      Returns the total number of recorded values.
      • Methods inherited from class java.lang.Object

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

      • BoundedHistogram

        public BoundedHistogram​(int upperBoundInclusive)
        Creates a histogram that accepts values in [0, upperBoundInclusive].
    • Method Detail

      • record

        public void record​(int value)
        Record the occurrence of the value in the histogram.
      • frequency

        public long frequency​(int value)
        Returns the number of recordings for the given value.
      • total

        public long total()
        Returns the total number of recorded values.
      • mean

        public double mean()
        Return the average value recorded.
      • median

        public int median()
        Return the median value recorded.
      • percentile

        public int percentile​(float percentile)
        Return the value that `percentile` percent of all values fall below.
      • stdDev

        public double stdDev()
        Return the standard deviation across all values.
      • min

        public int min()
        Returns the lowest recorded value in the histogram.
      • max

        public int max()
        Returns the highest recorded value in the histogram.
      • reset

        public void reset()
        Reset the recorded values within the histogram.
      • add

        public void add​(BoundedHistogram other)
        Adds all recorded values of `other` to `this` histogram.