Class TableDefinition
java.lang.Object
org.variantsync.diffdetective.tablegen.TableDefinition
- Direct Known Subclasses:
ShortTable
,Table1
,VariabilityShare
Definitions for the style of a table.
The style of a table includes the format of numbers and the definition of all columns including
their name in the header as well as a way to obtain their content..
-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<ColumnDefinition>
Definition of all columns in the table.protected NumberFormat
Format used to pretty print doubles.protected NumberFormat
Format used to pretty print integers. -
Constructor Summary
ModifierConstructorDescriptionprotected
TableDefinition
(List<ColumnDefinition> columnDefinitions) Creates a table definition withcolumnDefinitions
as columns. -
Method Summary
Modifier and TypeMethodDescriptionstatic ColumnDefinition
Constructs a new column definition.Returns the list of columns in the table.makeReadable
(double number) Pretty printsnumber
asdouble
, treating infinity and NaN as absent.makeReadable
(int number) Pretty printsnumber
asint
.makeReadable
(long number) Pretty printsnumber
aslong
, treating -1 as absent.makeReadable
(Number number) Pretty prints a number as either aint
ordouble
.makeReadable
(String number) Pretty printsnumber
asdouble
, treating infinity and NaN as absent.sortAndFilter
(List<ContentRow> rows, ContentRow ultimateResult) Returns a list of all rows that should appear in the table.
-
Field Details
-
intFormat
Format used to pretty print integers. -
doubleFormat
Format used to pretty print doubles. -
columnDefinitions
Definition of all columns in the table.
-
-
Constructor Details
-
TableDefinition
Creates a table definition withcolumnDefinitions
as columns. Numbers are use the US locale anddouble
s round to one digit after the decimal point a usingRoundingMode.HALF_UP
.
-
-
Method Details
-
makeReadable
Pretty prints a number as either aint
ordouble
. The selected type depends on presence of a fractional part innumber
.- See Also:
-
makeReadable
Pretty printsnumber
asint
.- See Also:
-
makeReadable
Pretty printsnumber
asdouble
, treating infinity and NaN as absent.- See Also:
-
makeReadable
Pretty printsnumber
aslong
, treating -1 as absent.- See Also:
-
makeReadable
Pretty printsnumber
asdouble
, treating infinity and NaN as absent.- See Also:
-
sortAndFilter
Returns a list of all rows that should appear in the table. The list of rows is final after this step, only the header is prepended.- Parameters:
rows
- the data to be sorted and filteredultimateResult
- a row containing accumulated results ofrows
-
columnDefinitions
Returns the list of columns in the table. -
col
public static ColumnDefinition col(String header, Alignment alignment, Function<ContentRow, Object> getCell) Constructs a new column definition.
-