public class Table<S,T,V>
extends java.lang.Object
| Constructor and Description |
|---|
Table() |
Table(java.util.Map<S,java.util.Map<T,V>> data) |
Table(Table<S,T,V> m) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Remove all data from the table.
|
boolean |
contains(S rowKey,
T colKey)
Checks, if an element exists at a given position.
|
boolean |
containsRowKey(S rowKey)
Checks, if a row with a given key exists.
|
java.lang.String |
format(RowKeyFormatter<S> rowKeyFormatter,
ColKeyFormatter<T> colKeyFormatter,
ValueFormatter<V> valueFormatter,
java.util.Comparator<? super S> rowKeyComparator,
java.util.Comparator<? super T> colKeyComparator,
java.lang.String title,
java.lang.String separator,
java.lang.String separator2,
boolean prettyfy) |
V |
get(S rowKey,
T colKey)
Provides the element at a given position.
|
java.util.List<V> |
getCol(T colKey)
Provides the column data for a given column key as list.
|
java.util.Set<T> |
getColKeys() |
java.util.List<T> |
getColKeys(java.util.Comparator<T> comparator) |
java.util.Map<S,java.util.Map<T,V>> |
getData()
Provides nested maps of the table data.
|
java.util.List<TableEntry<S,T,V>> |
getEntries() |
java.util.Set<KeyPair<S,T>> |
getKeyPairs() |
java.util.List<V> |
getRow(S rowKey)
Provides the row data for a given row key as list.
|
java.util.Set<S> |
getRowKeys() |
java.util.List<S> |
getRowKeys(java.util.Comparator<S> comparator) |
java.util.Map<T,V> |
getRowMap(S rowKey)
Provides the row data for a given row key as map.
|
boolean |
isEmpty()
Checks if the table is empty.
|
void |
merge(Table<S,T,V> other)
Merges the data of another table into this table.
|
void |
moveRow(S fromRowKey,
S toRowKey)
Moves all data from a certain row key to another row key
|
void |
put(S rowKey,
T colKey)
Stores a null data element at the given position, effectively just adding to row and column key.
|
void |
put(S rowKey,
T colKey,
V value)
Stores a data element at the given position.
|
void |
putRow(S rowKey,
java.util.Map<T,V> row)
Add complete row of data for a certain row key.
|
V |
remove(S rowKey,
T colKey)
Removes an element a the given position.
|
void |
removeRow(S rowKey)
Remove the row with the given key
|
void |
setData(java.util.Map<S,java.util.Map<T,V>> data)
Populates the table from nested maps.
|
int |
size()
Provides the size of this table.
|
java.lang.String |
toCsv() |
java.lang.String |
toCsv(RowKeyFormatter<S> rowKeyFormatter,
ColKeyFormatter<T> colKeyFormatter,
ValueFormatter<V> valueFormatter,
java.util.Comparator<? super S> rowKeyComparator,
java.util.Comparator<? super T> colKeyComparator) |
java.lang.String |
toPrettyTable() |
java.lang.String |
toPrettyTable(boolean numericRowKeys) |
java.lang.String |
toPrettyTable(java.lang.String title,
boolean numericRowKeys) |
java.lang.String |
toString() |
public boolean contains(S rowKey, T colKey)
rowKey - the row key of the positioncolKey - the column key of positiontrue if an element exists at the given position, false otherwisepublic V get(S rowKey, T colKey)
rowKey - the row key of the positioncolKey - the column key of positionnull otherwisepublic boolean containsRowKey(S rowKey)
rowKey - the row keytrue if an element exists at the given position, false otherwisepublic java.util.List<V> getRow(S rowKey)
rowKey - the row keypublic java.util.Map<T,V> getRowMap(S rowKey)
rowKey - the row keypublic java.util.List<V> getCol(T colKey)
colKey - the col keypublic java.util.Set<S> getRowKeys()
public java.util.Set<T> getColKeys()
public void moveRow(S fromRowKey, S toRowKey)
fromRowKey - the origin row keytoRowKey - the target row keypublic void putRow(S rowKey, java.util.Map<T,V> row)
rowKey - the key for the new rowrow - the row datapublic void put(S rowKey, T colKey, V value)
rowKey - the row key of the positioncolKey - the column key of the positionvalue - the data element to storepublic void put(S rowKey, T colKey)
rowKey - the row key of the positioncolKey - the column key of the positionpublic void removeRow(S rowKey)
rowKey - the key of the row to removepublic java.util.Map<S,java.util.Map<T,V>> getData()
public void setData(java.util.Map<S,java.util.Map<T,V>> data)
data - a map of maps with element datapublic V remove(S rowKey, T colKey)
rowKey - the row key of the positioncolKey - the column key of the positionpublic java.util.Set<KeyPair<S,T>> getKeyPairs()
KeyPair elements of the table data.public void merge(Table<S,T,V> other)
other - the other table to mergepublic java.util.List<TableEntry<S,T,V>> getEntries()
TableEntry elements of this tablepublic int size()
public void clear()
public boolean isEmpty()
true if the table is empty, false otherwisepublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toCsv()
public java.lang.String toCsv(RowKeyFormatter<S> rowKeyFormatter, ColKeyFormatter<T> colKeyFormatter, ValueFormatter<V> valueFormatter, java.util.Comparator<? super S> rowKeyComparator, java.util.Comparator<? super T> colKeyComparator)
public java.lang.String toPrettyTable()
public java.lang.String toPrettyTable(boolean numericRowKeys)
public java.lang.String toPrettyTable(java.lang.String title,
boolean numericRowKeys)
public java.lang.String format(RowKeyFormatter<S> rowKeyFormatter, ColKeyFormatter<T> colKeyFormatter, ValueFormatter<V> valueFormatter, java.util.Comparator<? super S> rowKeyComparator, java.util.Comparator<? super T> colKeyComparator, java.lang.String title, java.lang.String separator, java.lang.String separator2, boolean prettyfy)