Class DoubleBase2ExponentialHistogramBuckets

  • All Implemented Interfaces:
    ExponentialHistogramBuckets

    final class DoubleBase2ExponentialHistogramBuckets
    extends java.lang.Object
    implements ExponentialHistogramBuckets
    This class handles the operations for recording, scaling, and exposing data related to the base2 exponential histogram.

    This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

    • Constructor Detail

      • DoubleBase2ExponentialHistogramBuckets

        DoubleBase2ExponentialHistogramBuckets​(int scale,
                                               int maxBuckets,
                                               MemoryMode memoryMode)
    • Method Detail

      • clear

        void clear​(int scale)
        Resets all counters in this bucket set to zero and resets the scale to scale.
      • record

        boolean record​(double value)
      • getBucketCountsIntoReusableList

        void getBucketCountsIntoReusableList​(DynamicPrimitiveLongList reusableLongList)
        Fills the given reusable list with the bucket counts.

        NOTE: This is the same as getBucketCounts() but instead of returning a List with the values is fill the values into reusableLongList

        Parameters:
        reusableLongList - The list to fill with the bucket counts
      • downscale

        void downscale​(int by)
      • getScaleReduction

        int getScaleReduction​(double value)
        Returns the minimum scale reduction required to record the given value in these buckets, by calculating the new required window to allow the new value to be recorded. To be used with downScale().
        Parameters:
        value - The proposed value to be recorded.
        Returns:
        The required scale reduction in order to fit the value in these buckets.
      • getScaleReduction

        int getScaleReduction​(long newStart,
                              long newEnd)
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • sameBucketCounts

        private boolean sameBucketCounts​(DoubleBase2ExponentialHistogramBuckets other)
        Tests if two bucket counts are equivalent semantically.

        Semantic equivalence means:

        • All counts are stored between indexStart/indexEnd.
        • Offset does NOT need to be the same
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object