public class Table
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Table.InvalidElement
Error thrown if table element has not the expected type.
|
static class |
Table.InvalidFormat
Error thrown on invalid file format when reading a table.
|
static class |
Table.InvalidLocation
Error thrown on invalid table location argument.
|
Constructor and Description |
---|
Table() |
Table(java.util.ArrayList<java.lang.String> columnTitles) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
get(int column,
int row) |
java.lang.String |
get(java.lang.String columnTitle,
int row) |
int |
getColumnIndex(java.lang.String column) |
java.lang.String |
getColumnTitle(int index) |
java.util.ArrayList<java.lang.String> |
getColumnTitles() |
double |
getDouble(int column,
int row) |
double |
getDouble(java.lang.String columnTitle,
int row) |
int |
getInt(int column,
int row) |
int |
getInt(java.lang.String columnTitle,
int row) |
int |
getNumberColumns() |
int |
getNumberRows() |
java.lang.String |
getProperty(java.lang.String key)
Get meta information.
|
java.lang.String |
getProperty(java.lang.String key,
java.lang.String def)
Get meta information.
|
boolean |
hasProperty(java.lang.String key) |
void |
read(java.io.File file) |
void |
read(java.io.Reader reader) |
void |
save(java.io.File file) |
void |
save(java.io.Writer out) |
void |
save(java.io.Writer out,
boolean withHeader) |
void |
set(int column,
java.lang.String value)
Set element in last row.
|
void |
set(java.lang.String column,
double value) |
void |
set(java.lang.String column,
int value) |
void |
set(java.lang.String column,
java.lang.String value) |
java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
Set meta information.
|
void |
sortByIntColumn(int column,
int rowBegin,
int rowEnd) |
void |
sortByIntColumn(java.lang.String columnTitle,
int rowBegin,
int rowEnd) |
void |
startRow() |
public Table()
public Table(java.util.ArrayList<java.lang.String> columnTitles)
public java.lang.String get(int column, int row)
public java.lang.String get(java.lang.String columnTitle, int row) throws Table.InvalidLocation
Table.InvalidLocation
public double getDouble(int column, int row) throws Table.InvalidLocation, Table.InvalidElement
public double getDouble(java.lang.String columnTitle, int row) throws Table.InvalidLocation, Table.InvalidElement
public int getInt(int column, int row) throws Table.InvalidElement
Table.InvalidElement
public int getInt(java.lang.String columnTitle, int row) throws Table.InvalidLocation, Table.InvalidElement
public int getColumnIndex(java.lang.String column) throws Table.InvalidLocation
Table.InvalidLocation
public java.lang.String getColumnTitle(int index)
public java.util.ArrayList<java.lang.String> getColumnTitles()
public int getNumberColumns()
public int getNumberRows()
public java.lang.String getProperty(java.lang.String key)
key
- the property keypublic java.lang.String getProperty(java.lang.String key, java.lang.String def)
key
- the property keydef
- the default value, if this property does not existpublic boolean hasProperty(java.lang.String key)
public void read(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException, Table.InvalidFormat
java.io.FileNotFoundException
java.io.IOException
Table.InvalidFormat
public void read(java.io.Reader reader) throws java.io.IOException, Table.InvalidFormat
java.io.IOException
Table.InvalidFormat
public void save(java.io.File file) throws java.io.IOException
java.io.IOException
public void save(java.io.Writer out) throws java.io.IOException
java.io.IOException
public void save(java.io.Writer out, boolean withHeader) throws java.io.IOException
java.io.IOException
public void set(int column, java.lang.String value)
column
- Column in last row.value
- The value (must not contain newlines or tabs).public void set(java.lang.String column, int value) throws Table.InvalidLocation
Table.InvalidLocation
public void set(java.lang.String column, double value) throws Table.InvalidLocation
Table.InvalidLocation
public void set(java.lang.String column, java.lang.String value) throws Table.InvalidLocation
Table.InvalidLocation
public java.lang.Object setProperty(java.lang.String key, java.lang.String value)
key
- the property keyvalue
- the property valuepublic void startRow()
public void sortByIntColumn(int column, int rowBegin, int rowEnd) throws Table.InvalidElement
Table.InvalidElement
public void sortByIntColumn(java.lang.String columnTitle, int rowBegin, int rowEnd) throws Table.InvalidElement, Table.InvalidLocation