Class HistogramFormat<T>

    • Constructor Detail

      • HistogramFormat

        public HistogramFormat()
    • 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 a Long bucket count, a Long total of all bucket counts, and returns a String 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 new HistogramFormat.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.