public class SimpleDataTable extends AbstractDataTable implements java.lang.Comparable<DataTable>, java.lang.Cloneable
DataTable is a tabular structure that consist of TableFormat describing table fields and other options and a number of DataRecord objects representing
individual records.| Modifier and Type | Field and Description |
|---|---|
static DataTable |
EMPTY_TABLE |
DEFAULT_FORMAT, ELEMENT_ID| Constructor and Description |
|---|
SimpleDataTable()
Constructs a default
DataTable with empty TableFormat and zero records. |
SimpleDataTable(DataRecord record)
Constructs a
DataTable with one record specified by record parameter. |
SimpleDataTable(ElementList elements,
ClassicEncodingSettings settings,
boolean validate) |
SimpleDataTable(java.lang.String data)
Decodes
DataTable from string. |
SimpleDataTable(java.lang.String data,
boolean validate)
Decodes
DataTable from string and checks its validity. |
SimpleDataTable(java.lang.String data,
ClassicEncodingSettings settings,
boolean validate) |
SimpleDataTable(TableFormat format)
Constructs a
DataTable with specified TableFormat and zero records. |
SimpleDataTable(TableFormat format,
boolean createEmptyRecords)
Constructs a
DataTable with specified TableFormat and adds empty records to it. |
SimpleDataTable(TableFormat format,
int emptyRecords)
Constructs a
DataTable with specified TableFormat and adds emptyRecords of empty records to it. |
SimpleDataTable(TableFormat format,
java.lang.Object... firstRowData)
Constructs a
DataTable with specified TableFormat, adds one record and fills it with data. |
SimpleDataTable(TableFormat format,
java.lang.String dataString,
ClassicEncodingSettings settings) |
| Modifier and Type | Method and Description |
|---|---|
DataRecord |
addRecord()
Adds new record to the table.
|
DataTable |
addRecord(DataRecord record)
Adds new record to the table.
|
DataTable |
addRecord(int index,
DataRecord record)
Adds new record to the table at the specified index.
|
DataRecord |
addRecord(java.lang.Object... fieldValues)
Adds new record to the table.
|
DataTable |
clone() |
int |
compareTo(DataTable other) |
java.lang.String |
conformMessage(TableFormat rf) |
java.lang.String |
dataAsString(boolean showFieldNames,
boolean showHiddenFields,
boolean showPasswords) |
boolean |
equals(java.lang.Object obj) |
java.lang.Integer |
findIndex(DataTableQuery query) |
java.lang.Object |
get()
Returns value of first field in first record of the table.
|
DataRecord |
getRecord(int number)
Returns record with specified index.
|
java.lang.Integer |
getRecordCount()
Returns number of records in the table.
|
java.util.List<DataRecord> |
getRecords()
Returns list of table records.
|
int |
hashCode() |
boolean |
isOneCellTable()
Returns true if table has exactly one record and one field.
|
boolean |
isSimple() |
java.util.Iterator<DataRecord> |
iterator() |
java.util.Iterator<DataRecord> |
iterator(int index) |
void |
joinFormats() |
DataTable |
makeImmutable() |
protected DataRecord |
removeRecordImpl(int index) |
void |
removeRecords(DataRecord rec)
Removes all records equal to the rec parameter from the table.
|
void |
removeRecordsByIds(java.util.Collection<java.lang.String> ids)
Removes all records from the table which contain in ids.
|
void |
reorderRecord(DataRecord record,
int index)
Moves specified record to position specified by
index argument. |
void |
setId(java.lang.Long id)
Sets table ID.
|
DataTable |
setRecord(int index,
DataRecord record)
Replaces record at the specified index.
|
void |
sort(java.util.Comparator<DataRecord> comparator) |
void |
sort(DataTableSorter sorter) |
void |
splitFormat() |
java.util.stream.Stream<DataRecord> |
stream() |
void |
swapRecords(int index1,
int index2)
Swaps two records.
|
java.lang.String |
toDefaultString() |
addRecords, append, applyCachedFormat, cloneIfImmutable, close, conform, dataAsString, dataAsString, encode, encode, encode, encode, findIndex, findIndex, fixRecords, getDescription, getEncodedData, getEncodedData, getFieldCount, getFormat, getFormat, getFormat, getId, getInvalidationMessage, getQuality, getRecordById, getTimestamp, getValue, hasField, isImmutable, isInvalid, rec, removeRecord, select, select, selectAll, setFormat, setInvalidationMessage, setQuality, setTimestamp, sort, toString, validate, validateRecordpublic static final DataTable EMPTY_TABLE
public SimpleDataTable()
DataTable with empty TableFormat and zero records.public SimpleDataTable(TableFormat format)
DataTable with specified TableFormat and zero records.public SimpleDataTable(TableFormat format, int emptyRecords)
DataTable with specified TableFormat and adds emptyRecords of empty records to it.public SimpleDataTable(TableFormat format, boolean createEmptyRecords)
DataTable with specified TableFormat and adds empty records to it.
If createEmptyRecords parameter is true, a minimal number of empty records specified by TableFormat is added to the table.public SimpleDataTable(DataRecord record)
DataTable with one record specified by record parameter.
TableFormat of resulting table is taken from format of record.public SimpleDataTable(TableFormat format, java.lang.String dataString, ClassicEncodingSettings settings) throws DataTableException
DataTableExceptionpublic SimpleDataTable(TableFormat format, java.lang.Object... firstRowData)
DataTable with specified TableFormat, adds one record and fills it with data.
Data to be put into the first record is specified by firstRowData parameter.public SimpleDataTable(java.lang.String data)
throws DataTableException
DataTable from string.DataTableExceptionpublic SimpleDataTable(java.lang.String data,
boolean validate)
throws DataTableException
DataTable from string and checks its validity.DataTableExceptionpublic SimpleDataTable(java.lang.String data,
ClassicEncodingSettings settings,
boolean validate)
throws DataTableException
DataTableExceptionpublic SimpleDataTable(ElementList elements, ClassicEncodingSettings settings, boolean validate) throws DataTableException
DataTableExceptionpublic java.lang.Integer getRecordCount()
getRecordCount in interface DataTablepublic void setId(java.lang.Long id)
public DataTable addRecord(DataRecord record)
public DataRecord addRecord(java.lang.Object... fieldValues)
public DataTable addRecord(int index, DataRecord record)
public DataRecord addRecord()
public DataTable setRecord(int index, DataRecord record)
public void swapRecords(int index1,
int index2)
IllegalStateExceptionswapRecords in interface DataTableswapRecords in class AbstractDataTablepublic java.util.List<DataRecord> getRecords()
getRecords in interface DataTablegetRecords in class AbstractDataTablepublic DataRecord getRecord(int number)
protected DataRecord removeRecordImpl(int index)
removeRecordImpl in class AbstractDataTablepublic void removeRecordsByIds(java.util.Collection<java.lang.String> ids)
DataTableremoveRecordsByIds in interface DataTableremoveRecordsByIds in class AbstractDataTablepublic void removeRecords(DataRecord rec)
removeRecords in interface DataTablepublic void reorderRecord(DataRecord record, int index)
index argument.
record must belong to this table, otherwise method will throw an IllegalStateExceptionreorderRecord in interface DataTablepublic boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.String toDefaultString()
toDefaultString in interface DataTablepublic java.lang.String dataAsString(boolean showFieldNames,
boolean showHiddenFields,
boolean showPasswords)
dataAsString in interface DataTablepublic boolean isOneCellTable()
isOneCellTable in interface DataTablepublic java.lang.String conformMessage(TableFormat rf)
conformMessage in interface DataTableconformMessage in class AbstractDataTablepublic java.lang.Integer findIndex(DataTableQuery query)
public void sort(DataTableSorter sorter)
public void sort(java.util.Comparator<DataRecord> comparator)
public java.lang.Object get()
AbstractDataTableget in interface DataTableget in class AbstractDataTablepublic void splitFormat()
splitFormat in interface DataTablesplitFormat in class AbstractDataTablepublic void joinFormats()
joinFormats in interface DataTablejoinFormats in class AbstractDataTablepublic java.util.Iterator<DataRecord> iterator()
iterator in interface DataTableiterator in interface java.lang.Iterable<DataRecord>public java.util.Iterator<DataRecord> iterator(int index)
public DataTable clone()
clone in interface DataTableclone in interface PublicCloneableclone in class AbstractDataTablepublic int compareTo(DataTable other)
public DataTable makeImmutable()
makeImmutable in interface DataTablepublic java.util.stream.Stream<DataRecord> stream()
stream in interface DataTablestream in class AbstractDataTable