Class ConsoleHistogramQuantityFormatter<T extends Quantity<T>>
- java.lang.Object
-
- com.pervasivecode.utils.stats.histogram.ConsoleHistogramFormatter<Quantity<T>>
-
- com.pervasivecode.utils.stats.histogram.measure.ConsoleHistogramQuantityFormatter<T>
-
- Type Parameters:
T- The type of quantity value the histogram counted, which this formatter will format using the providedquantityFormatter.
public class ConsoleHistogramQuantityFormatter<T extends Quantity<T>> extends ConsoleHistogramFormatter<Quantity<T>>
FormatHistogram<Quantity>contents for a text display. The formatted output consists of a vertical list of labeled histogram buckets, with horizontal bar graphs showing the count in each bucket, followed by a percentage that represents the number of items counted in this bucket as a fraction of all items counted by this histogram.This version of
ConsoleHistogramFormatterhandles JSR-363Quantityobjects, which represent values of a certain measurement (e.g.Mass,Energy,Length,LuminousFlux) that have a unit attached (e.g. kilometers, megajoules, furlongs, bits per second, etc.).Example output from a
ConsoleHistogramQuantityFormatter<Power>:<= 1 kW 0% <= 10 kW 0% <= 100 kW 0% <= 1 MW **** 2% <= 10 MW ************************************************************ 38% <= 100 MW ******************************************************** 35% <= 1 GW ****************************** 19% <= 10 GW ******** 5% > 10 GW 0%
-
-
Constructor Summary
Constructors Constructor Description ConsoleHistogramQuantityFormatter(QuantityFormatter<T> quantityFormatter, int maxBarGraphWidth)Create a ConsoleHistogramQuantityFormatter that formats upper bound values usingquantityFormatter.
-
-
-
Constructor Detail
-
ConsoleHistogramQuantityFormatter
public ConsoleHistogramQuantityFormatter(QuantityFormatter<T> quantityFormatter, int maxBarGraphWidth)
Create a ConsoleHistogramQuantityFormatter that formats upper bound values usingquantityFormatter.- Parameters:
quantityFormatter- An object that converts an upper bound quantity into a String representation.maxBarGraphWidth- The maximum width of the bar graph portion of the formatted representation.
-
-