public class DataTable extends AbstractDataSource implements MutableDataSource
DataSource
,
MutableDataSource
,
Serialized FormConstructor and Description |
---|
DataTable(Class<? extends Comparable<?>>... types)
Initializes a new instance with the specified number of columns and
column types.
|
DataTable(DataSource source)
Initializes a new instance with the column types, and data of another
data source.
|
DataTable(int cols,
Class<? extends Comparable<?>> type)
Initializes a new instance with the specified number of columns and
a single column type.
|
Modifier and Type | Method and Description |
---|---|
int |
add(Collection<? extends Comparable<?>> values)
Adds a row with the specified container's elements to the table.
|
int |
add(Comparable<?>... values)
Adds a row with the specified comparable values to the table.
|
int |
add(Row row)
Adds the specified row to the table.
|
void |
clear()
Deletes all rows this table contains.
|
Comparable<?> |
get(int col,
int row)
Returns the row with the specified index.
|
int |
getRowCount()
Returns the number of rows of the data source.
|
void |
remove(int row)
Removes a specified row from the table.
|
void |
removeLast()
Removes the last row from the table.
|
<T> Comparable<T> |
set(int col,
int row,
Comparable<T> value)
Sets the value of a cell specified by its column and row indexes.
|
void |
sort(DataComparator... comparators)
Sorts the table rows with the specified DataComparators.
|
addDataListener, getColumn, getColumnCount, getColumnTypes, getRow, getStatistics, isColumnNumeric, iterator, notifyDataAdded, notifyDataRemoved, notifyDataUpdated, removeDataListener, setColumnTypes
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addDataListener, getColumn, getColumnCount, getColumnTypes, getRow, getStatistics, isColumnNumeric, removeDataListener
public DataTable(Class<? extends Comparable<?>>... types)
types
- Type for each columnpublic DataTable(int cols, Class<? extends Comparable<?>> type)
cols
- Number of columnstype
- Data type for all columnspublic DataTable(DataSource source)
source
- Data source to clone.public int add(Comparable<?>... values)
IllegalArgumentException
is thrown.add
in interface MutableDataSource
values
- values to be added as a rowpublic int add(Collection<? extends Comparable<?>> values)
IllegalArgumentException
is thrown.add
in interface MutableDataSource
values
- values to be added as a rowpublic int add(Row row)
IllegalArgumentException
is thrown.add
in interface MutableDataSource
row
- Row to be addedpublic void remove(int row)
remove
in interface MutableDataSource
row
- Index of the row to removepublic void removeLast()
removeLast
in interface MutableDataSource
public void clear()
clear
in interface MutableDataSource
public Comparable<?> get(int col, int row)
get
in interface DataSource
col
- index of the column to returnrow
- index of the row to returnpublic <T> Comparable<T> set(int col, int row, Comparable<T> value)
set
in interface MutableDataSource
T
- Data type of the cell.col
- Column of the cell to change.row
- Row of the cell to change.value
- New value to be set.public int getRowCount()
getRowCount
in interface DataSource
public void sort(DataComparator... comparators)
sort
in interface MutableDataSource
comparators
- comparators used for sortingCopyright © 2009-2013. All Rights Reserved.