public class Table<T> extends Object
Modifier and Type | Field and Description |
---|---|
protected SimpleVector<String> |
columnHeadings |
protected ArrayList<SimpleVector<T>> |
rows |
Constructor and Description |
---|
Table()
create an empty table
|
Table(String[] columns)
create an empty table with the given column headings
|
Table(Table<T> t)
create an empty table with the same column headings as t
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(Map<String,T> p) |
int[] |
computeColumnWidths() |
String |
getColumnHeading(int i)
Note that column indices start at zero
|
T |
getElement(int row,
int column) |
int |
getNumberOfColumns() |
int |
getNumberOfRows() |
static void |
padWithSpaces(StringBuffer b,
int length) |
void |
removeRow(Map<String,T> p) |
Map<String,T> |
row2Map(int row) |
String |
toString() |
protected final ArrayList<SimpleVector<T>> rows
protected final SimpleVector<String> columnHeadings
public Table()
public Table(Table<T> t) throws IllegalArgumentException
IllegalArgumentException
- if t == nullpublic Table(String[] columns) throws IllegalArgumentException
IllegalArgumentException
- if columns == null, or columns[i] == null for some ipublic T getElement(int row, int column)
public String getColumnHeading(int i)
public int[] computeColumnWidths()
public int getNumberOfColumns()
public int getNumberOfRows()
public static void padWithSpaces(StringBuffer b, int length)