Class AsciiTableFormatter
java.lang.Object
com.github.rlacher.sortbench.util.AsciiTableFormatter
Formats a list of
AggregatedResult into an ASCII table.-
Constructor Summary
ConstructorsConstructorDescriptionParameterless constructor initialising class fields to defaults (i.e.AsciiTableFormatter(Locale locale, char titleRowDelimiter, char columnDelimiter) Overloaded constructor initialising class fields with providedLocaleand delimiters. -
Method Summary
Modifier and TypeMethodDescriptionformat(List<AggregatedResult> results) Entry point for formatting a list ofAggregatedResultinto an ASCII table.
-
Constructor Details
-
AsciiTableFormatter
public AsciiTableFormatter()Parameterless constructor initialising class fields to defaults (i.e. delimiters, number formatter). -
AsciiTableFormatter
Overloaded constructor initialising class fields with providedLocaleand delimiters.- Parameters:
locale- TheLocaleto use for number formatting. Must not benull.titleRowDelimiter- The character to use for the title row delimiter.columnDelimiter- The character to use for the column delimiter.- Throws:
IllegalArgumentException- Iflocaleisnullor if the delimiters are not printable ASCII characters.
-
-
Method Details
-
format
Entry point for formatting a list ofAggregatedResultinto an ASCII table.Uses the delimiters and number formatter defined in the constructor.
- Parameters:
results- The list ofAggregatedResultto format.- Returns:
- The formatted ASCII table as a
String. - Throws:
IllegalArgumentException- If the results list isnullor empty.
-