Package ai.libs.jaicore.basic.kvstore
Class Table<V>
- java.lang.Object
-
- ai.libs.jaicore.basic.kvstore.Table<V>
-
- Type Parameters:
V- Datatype of an entry's value.
public class Table<V> extends java.lang.ObjectAllows to arrange data of type V into a matrix structure. Filling the table works providing a column key and a row key.
-
-
Constructor Summary
Constructors Constructor Description Table()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(java.lang.String columnIndexValue, java.lang.String rowIndexValue, V entry)Adds a value to the cell identified by the columnIndexValue and the rowIndexValue.java.util.List<java.lang.String>getColumnsOfCSV()java.util.List<java.lang.String>getRowsOfCSV()voidsortColumns(java.util.Comparator<? super java.lang.String> c)Allows to sort the columns of the table.voidsortRows(java.util.Comparator<? super java.lang.String> c)Allows to sort the rows of the table.java.lang.StringtoCSV(java.lang.String standardValue)Converts the table into CSV format.java.lang.StringtoCSV(java.lang.String separator, java.lang.String standardValue)Converts the table into CSV format.java.lang.StringtoLaTeX()Converts the table to latex code, empty cells are filled with an empty string.java.lang.StringtoLaTeX(java.lang.String missingEntry)Converts the table to latex code, empty cells are filled with the provided missingEntry String.
-
-
-
Method Detail
-
add
public void add(java.lang.String columnIndexValue, java.lang.String rowIndexValue, V entry)Adds a value to the cell identified by the columnIndexValue and the rowIndexValue. Already existing values are overwritten.- Parameters:
columnIndexValue- The name of the column.rowIndexValue- The name of the row.entry- The entry to add to the table's cell.
-
toLaTeX
public java.lang.String toLaTeX()
Converts the table to latex code, empty cells are filled with an empty string.- Returns:
- The latex code representing this table.
-
toLaTeX
public java.lang.String toLaTeX(java.lang.String missingEntry)
Converts the table to latex code, empty cells are filled with the provided missingEntry String.- Parameters:
missingEntry- Value of empty table cells.- Returns:
- The latex code representing this table.
-
toCSV
public java.lang.String toCSV(java.lang.String standardValue)
Converts the table into CSV format.- Parameters:
standardValue- Value to assign for non-existing entries.- Returns:
- String in CSV format describing the data of the table.
-
toCSV
public java.lang.String toCSV(java.lang.String separator, java.lang.String standardValue)Converts the table into CSV format.- Parameters:
separator- The symbol to separate values in the CSV format.standardValue- Value to assign for non-existing entries.- Returns:
- String in CSV format describing the data of the table.
-
getColumnsOfCSV
public java.util.List<java.lang.String> getColumnsOfCSV()
- Returns:
- Returns the index of columns of this table.
-
getRowsOfCSV
public java.util.List<java.lang.String> getRowsOfCSV()
- Returns:
- Returns the index of rows of this table.
-
sortColumns
public void sortColumns(java.util.Comparator<? super java.lang.String> c)
Allows to sort the columns of the table.- Parameters:
c- The comparator to use for sorting.
-
sortRows
public void sortRows(java.util.Comparator<? super java.lang.String> c)
Allows to sort the rows of the table.- Parameters:
c- The comparator to use for sorting.
-
-