Class ExponentialHistogramBuilder
java.lang.Object
org.elasticsearch.exponentialhistogram.ExponentialHistogramBuilder
- All Implemented Interfaces:
Closeable,AutoCloseable,Releasable
A builder for building a
ReleasableExponentialHistogram directly from buckets.-
Method Summary
Modifier and TypeMethodDescriptionbuild()voidclose()estimatedBucketCount(int totalBuckets) If known, sets the estimated total number of buckets to minimize unnecessary allocations.max(double max) Sets the max value of the histogram values.min(double min) Sets the min value of the histogram values.scale(int scale) setNegativeBucket(long index, long count) Sets the given bucket of the negative buckets.setPositiveBucket(long index, long count) Sets the given bucket of the positive buckets.sum(double sum) Sets the sum of the histogram values.zeroBucket(ZeroBucket zeroBucket)
-
Method Details
-
estimatedBucketCount
If known, sets the estimated total number of buckets to minimize unnecessary allocations. Only has an effect if invoked before the first call tosetPositiveBucket(long, long)andsetNegativeBucket(long, long).- Parameters:
totalBuckets- the total number of buckets expected to be added- Returns:
- the builder
-
scale
-
zeroBucket
-
sum
Sets the sum of the histogram values. If not set, the sum will be estimated from the buckets.- Parameters:
sum- the sum value- Returns:
- the builder
-
min
Sets the min value of the histogram values. If not set, the min will be estimated from the buckets.- Parameters:
min- the min value- Returns:
- the builder
-
max
Sets the max value of the histogram values. If not set, the max will be estimated from the buckets.- Parameters:
max- the max value- Returns:
- the builder
-
setPositiveBucket
Sets the given bucket of the positive buckets. If the bucket already exists, it will be replaced. Buckets may be set in arbitrary order. However, for best performance and minimal allocations, buckets should be set in order of increasing index and all negative buckets should be set before positive buckets.- Parameters:
index- the index of the bucketcount- the count of the bucket, must be at least 1- Returns:
- the builder
-
setNegativeBucket
Sets the given bucket of the negative buckets. If the bucket already exists, it will be replaced. Buckets may be set in arbitrary order. However, for best performance and minimal allocations, buckets should be set in order of increasing index and all negative buckets should be set before positive buckets.- Parameters:
index- the index of the bucketcount- the count of the bucket, must be at least 1- Returns:
- the builder
-
build
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable
-