public abstract class TableContainer<R,C,V> extends Object implements Cloneable, Serializable
| Constructor and Description |
|---|
TableContainer(String headerName) |
| Modifier and Type | Method and Description |
|---|---|
TableContainer<R,C,V> |
clean()
Clean all content in the container.
|
TableContainer<R,C,V> |
clone() |
List<C> |
columnKeys()
Get column keys organized as a
List. |
Map<C,Map<R,V>> |
columnMap()
Get the table organized by column keys.
|
static Long |
CONTAINER_COUNT()
Container id is an auto-increment attribute for identifying a container.
|
TableContainer<R,C,V> |
filter(@Nullable Predicate<R> rowFilter,
@Nullable Predicate<C> columnFilter)
Cut current container through filters.
|
V |
get(R row,
C column)
Get a cell based on (row, column).
|
String |
getHeaderName() |
abstract TableContainer<R,C,V> |
load(String path)
Load data from external storage into container.
|
TableContainer<R,C,V> |
merge(TableContainer<R,C,V> other)
Merge two containers into one and replaced the current.
|
String |
NULL_CHARACTER_DISPLAY()
Used for printing through console.
|
String |
NULL_CHARACTER_DISPLAY(String NULL_CHARACTER_DISPLAY)
Set customized NULL_CHARACTER_DISPLAY to replace NULL value when printing.
|
abstract void |
persist(String path)
Persist container data to external permanent storage.
|
String |
print()
Print the container to the console.
|
String |
print(PrintStream printStream)
Print the container to the specified print stream.
|
TableContainer<R,C,V> |
push(R row,
C column,
V value)
Push a cell into container.
|
List<R> |
rowKeys()
Get row keys organized as a
List. |
Map<R,Map<C,V>> |
rowMap()
Get the table organized by row keys.
|
void |
setHeaderName(String headerName) |
Map<R,V> |
singleColumn(C column)
Get a single column based on column key.
|
Map<C,V> |
singleRow(R row)
Get a single row based on row key.
|
TableContainer<R,C,V> |
sort()
Sort current container based on the dictionary order of row and column keys.
|
public TableContainer(String headerName)
public static Long CONTAINER_COUNT()
public String NULL_CHARACTER_DISPLAY()
The NULL_CHARACTER_DISPLAY is used to replace NULL value.
public String NULL_CHARACTER_DISPLAY(String NULL_CHARACTER_DISPLAY)
NULL_CHARACTER_DISPLAY - the character replacedpublic Map<R,Map<C,V>> rowMap()
public Map<C,Map<R,V>> columnMap()
public Map<C,V> singleRow(R row)
row - row keypublic Map<R,V> singleColumn(C column)
column - column keypublic List<R> rowKeys()
List.public List<C> columnKeys()
List.public TableContainer<R,C,V> push(R row, C column, V value)
row - row keycolumn - column keyvalue - cell value@Nullable public V get(R row, C column)
row - row keycolumn - column keypublic TableContainer<R,C,V> clean()
public abstract void persist(String path) throws DataPersistenceException
path - external storage pathDataPersistenceException - error appearance such as IOException and so onpublic abstract TableContainer<R,C,V> load(String path) throws DataLoadingException
path - external storage pathDataLoadingException - error appearance such as IOException, IllegalValueTypeException and so onpublic TableContainer<R,C,V> merge(TableContainer<R,C,V> other)
other - another container with the sample (R, C, V) typepublic TableContainer<R,C,V> filter(@Nullable @Nullable Predicate<R> rowFilter, @Nullable @Nullable Predicate<C> columnFilter)
null.rowFilter - the filter applied for row keyscolumnFilter - the filter applied for column keyspublic TableContainer<R,C,V> sort()
public String print()
public String print(PrintStream printStream)
printStream - the stream to receive outputpublic String getHeaderName()
public void setHeaderName(String headerName)
Copyright © 2019. All rights reserved.