Class ConcurrentHistogram<T>

    • Constructor Detail

      • ConcurrentHistogram

        public ConcurrentHistogram​(BucketSelector<T> bucketer)
    • Method Detail

      • numBuckets

        public int numBuckets()
        Description copied from interface: BucketingSystem
        Get the total number of buckets. This will not be smaller than 1.
        Specified by:
        numBuckets in interface BucketingSystem<T>
        Returns:
        The number of buckets.
      • bucketUpperBound

        public T bucketUpperBound​(int index)
        Description copied from interface: BucketingSystem
        Get the upper-bound value of the specified bucket.

        The first bucket has an index of 0. The last bucket has no upper bound, so passing the last index value in index is not allowed and will result in an IllegalArgumentException being thrown. In other words, if there are 10 buckets in a given instance, there are only 9 upper bound values, so the valid index values are 0 through 8 inclusive.

        A BucketingSystem with only one bucket is valid (all values fall in that bucket), but would have no upper bound values, so this method would always throw an IllegalArgumentException (for index value 0) or an IndexOutOfBoundsException (for all other values of index).

        Specified by:
        bucketUpperBound in interface BucketingSystem<T>
        Parameters:
        index - The bucket index to examine. This must be a value from zero through the next-to-last bucket index.
        Returns:
        The upper bound value of the specified bucket. This will not be null.
      • countInBucket

        public long countInBucket​(int index)
        Description copied from interface: Histogram
        Get the number of elements that were counted in the specified bucket. The first bucket has an index of 0.
        Specified by:
        countInBucket in interface Histogram<T>
        Parameters:
        index - The bucket number to examine.
        Returns:
        The count of values in the specified bucket.
      • countValue

        public void countValue​(T value)
        Description copied from interface: MutableHistogram
        Count the specified value by assigning it to a bucket and incrementing the stored count of values that belong to that bucket.
        Specified by:
        countValue in interface MutableHistogram<T>
        Parameters:
        value - The value to count. This must not be null.