Class HistogramFormat<T>
- java.lang.Object
-
- com.pervasivecode.utils.stats.histogram.HistogramFormat<T>
-
- Type Parameters:
T
- The type of value that this HistogramFormat can handle.
@Immutable public abstract class HistogramFormat<T> extends Object
Configuration for aHistogramFormatter
.- See Also:
HistogramBucketCountFormatters
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
HistogramFormat.Builder<T>
This object is used to construct a HistogramFormat instance.
-
Constructor Summary
Constructors Constructor Description HistogramFormat()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract BiFunction<Long,Long,String>
bucketCountFormatter()
A BiFunction that specifies how a bucket count value should be displayed.static <T> HistogramFormat.Builder<T>
builder()
Create a newHistogramFormat.Builder
instance.abstract String
labelForSingularBucket()
The string label to use when the Histogram contains exactly one bucket.abstract int
maxWidth()
The maximum width of the formatted representation, in characters.abstract Function<T,String>
upperBoundValueFormatter()
A function that formats a bucket upper bound value as a String.
-
-
-
Method Detail
-
upperBoundValueFormatter
public abstract Function<T,String> upperBoundValueFormatter()
A function that formats a bucket upper bound value as a String.- Returns:
- The value formatter function.
-
labelForSingularBucket
public abstract String labelForSingularBucket()
The string label to use when the Histogram contains exactly one bucket.- Returns:
- The label to use for a single-bucket histogram.
-
bucketCountFormatter
public abstract BiFunction<Long,Long,String> bucketCountFormatter()
A BiFunction that specifies how a bucket count value should be displayed.This could be a percentage of the total number of items counted by the histogram across all buckets, or just the bucket count itself if a percentage is not desired.
- Returns:
- bucketCountFormatter A
BiFunction
that takes aLong
bucket count, aLong
total of all bucket counts, and returns aString
formatted representation.
-
maxWidth
public abstract int maxWidth()
The maximum width of the formatted representation, in characters.- Returns:
- The maximum width of the bar graph.
-
builder
public static <T> HistogramFormat.Builder<T> builder()
Create a newHistogramFormat.Builder
instance.This builder is mostly unconfigured, except for the following default values:
- labelForSingularBucket = "?"
- Type Parameters:
T
- The type of value handled by the HistogramFormat that this Builder will make.- Returns:
- The new
HistogramFormat.Builder
instance.
-
-