Package org.dashbuilder.dataset.impl
Class DataSetImpl
- java.lang.Object
-
- org.dashbuilder.dataset.impl.DataSetImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected List<DataColumnImpl>columnsprotected DatecreationDateprotected DataSetDefdefinitionprotected introwCountNonTrimmedprotected Stringuuid
-
Constructor Summary
Constructors Constructor Description DataSetImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void_setEmptyRowAt(int row, boolean insert)protected void_setValueAt(int row, int column, Object value, boolean insert)protected void_setValuesAt(int row, boolean insert, Object... values)DataSetaddColumn(String id, ColumnType type)Add a brand new column.DataSetaddColumn(String id, ColumnType type, List values)Add a brand new column populated with the given values.DataSetaddColumn(DataColumn column)Add a brand new column.DataSetaddEmptyRowAt(int row)Add an empty row at the given position.DataSetaddValueAt(int row, int column, Object value)DataSetaddValueAt(int column, Object value)DataSetaddValues(Object... values)Add a row at the end of the data set.DataSetaddValuesAt(int row, Object... values)Add a row at the given position.DataSetImplcloneEmpty()Build a data set with the same structure as this but containing no data.DataSetImplcloneInstance()Build a data set with the same structure and content.Objectconvert(DataColumn column, Object value)DateconvertToDate(Object value)DoubleconvertToDouble(Object value)StringconvertToString(Object value)booleanequals(Object obj)DataColumngetColumnById(String id)Get a column by its id.DataColumngetColumnByIndex(int index)Get a column by its index (starting at 0).intgetColumnIndex(DataColumn dataColumn)Get a column's internal DataSet index.List<DataColumn>getColumns()The dataset columnsDategetCreationDate()The creation dateDataSetDefgetDefinition()The data set definitionlonggetEstimatedSize()Return the estimated memory (in bytes) the data set is consuming.DataSetMetadatagetMetadata()The metadataintgetRowCount()Get the number of rows in the dataset.intgetRowCountNonTrimmed()If this data set is the result of a trim operation this method will return the total number of rows existing before trim.StringgetUUID()The unique data set identifier.ObjectgetValueAt(int row, int column)Get the value at a given cell.ObjectgetValueAt(int row, String columnId)Get the value at a given cell.protected ObjectgetValueAt(int row, DataColumn column)booleanisEmpty()DataSetremoveColumn(String id)Removes an existing column.voidsetColumns(List<DataColumn> columnList)voidsetCreationDate(Date creationDate)The creation datevoidsetDefinition(DataSetDef definition)The data set definitionvoidsetRowCountNonTrimmed(int rowCountNonTrimmed)If this data set is the result of a trim operation this method will return the total number of rows existing before trim.voidsetUUID(String uuid)Set an unique identifier to this data set.DataSetsetValueAt(int row, int column, Object value)Set the value at a given cell.DataSetsetValuesAt(int row, Object... values)Set all the values for a given row.DataSettrim(int offset, int rows)Returns a data set containing only the specified row sub set.DataSettrim(List<Integer> rows)Returns a data set containing only the specified row sub set.
-
-
-
Field Detail
-
definition
protected DataSetDef definition
-
uuid
protected String uuid
-
creationDate
protected Date creationDate
-
columns
protected List<DataColumnImpl> columns
-
rowCountNonTrimmed
protected int rowCountNonTrimmed
-
-
Method Detail
-
getMetadata
public DataSetMetadata getMetadata()
Description copied from interface:DataSetThe metadata- Specified by:
getMetadatain interfaceDataSet
-
getDefinition
public DataSetDef getDefinition()
Description copied from interface:DataSetThe data set definition- Specified by:
getDefinitionin interfaceDataSet
-
setDefinition
public void setDefinition(DataSetDef definition)
Description copied from interface:DataSetThe data set definition- Specified by:
setDefinitionin interfaceDataSet
-
getUUID
public String getUUID()
Description copied from interface:DataSetThe unique data set identifier.
-
setUUID
public void setUUID(String uuid)
Description copied from interface:DataSetSet an unique identifier to this data set.
-
getCreationDate
public Date getCreationDate()
Description copied from interface:DataSetThe creation date- Specified by:
getCreationDatein interfaceDataSet
-
setCreationDate
public void setCreationDate(Date creationDate)
Description copied from interface:DataSetThe creation date- Specified by:
setCreationDatein interfaceDataSet
-
getColumns
public List<DataColumn> getColumns()
Description copied from interface:DataSetThe dataset columns- Specified by:
getColumnsin interfaceDataSet
-
setColumns
public void setColumns(List<DataColumn> columnList)
- Specified by:
setColumnsin interfaceDataSet
-
getColumnById
public DataColumn getColumnById(String id)
Description copied from interface:DataSetGet a column by its id.- Specified by:
getColumnByIdin interfaceDataSet
-
getColumnByIndex
public DataColumn getColumnByIndex(int index)
Description copied from interface:DataSetGet a column by its index (starting at 0).- Specified by:
getColumnByIndexin interfaceDataSet
-
getColumnIndex
public int getColumnIndex(DataColumn dataColumn)
Description copied from interface:DataSetGet a column's internal DataSet index.- Specified by:
getColumnIndexin interfaceDataSet
-
addColumn
public DataSet addColumn(String id, ColumnType type)
Description copied from interface:DataSetAdd a brand new column.
-
addColumn
public DataSet addColumn(String id, ColumnType type, List values)
Description copied from interface:DataSetAdd a brand new column populated with the given values.
-
addColumn
public DataSet addColumn(DataColumn column)
Description copied from interface:DataSetAdd a brand new column.
-
removeColumn
public DataSet removeColumn(String id)
Description copied from interface:DataSetRemoves an existing column.- Specified by:
removeColumnin interfaceDataSet
-
isEmpty
public boolean isEmpty()
-
getRowCount
public int getRowCount()
Description copied from interface:DataSetGet the number of rows in the dataset.- Specified by:
getRowCountin interfaceDataSet
-
getRowCountNonTrimmed
public int getRowCountNonTrimmed()
Description copied from interface:DataSetIf this data set is the result of a trim operation this method will return the total number of rows existing before trim.- Specified by:
getRowCountNonTrimmedin interfaceDataSet- Returns:
- The total number of existing rows before any trim operation (if any) or -1 if no trim operation has been carried out.
-
setRowCountNonTrimmed
public void setRowCountNonTrimmed(int rowCountNonTrimmed)
Description copied from interface:DataSetIf this data set is the result of a trim operation this method will return the total number of rows existing before trim.- Specified by:
setRowCountNonTrimmedin interfaceDataSet
-
getValueAt
public Object getValueAt(int row, String columnId)
Description copied from interface:DataSetGet the value at a given cell.- Specified by:
getValueAtin interfaceDataSet- Parameters:
row- The cell row (the first row is 0).columnId- The cell column id.
-
getValueAt
public Object getValueAt(int row, int column)
Description copied from interface:DataSetGet the value at a given cell.- Specified by:
getValueAtin interfaceDataSet- Parameters:
row- The cell row (the first row is 0).column- The cell column (the first column is 0).
-
getValueAt
protected Object getValueAt(int row, DataColumn column)
-
setValueAt
public DataSet setValueAt(int row, int column, Object value)
Description copied from interface:DataSetSet the value at a given cell.- Specified by:
setValueAtin interfaceDataSet- Parameters:
row- The cell row (the first row is 0).column- The cell column (the first column is 0).
-
_setValueAt
protected void _setValueAt(int row, int column, Object value, boolean insert)
-
setValuesAt
public DataSet setValuesAt(int row, Object... values)
Description copied from interface:DataSetSet all the values for a given row.- Specified by:
setValuesAtin interfaceDataSet- Parameters:
row- The cell row (the first row is 0).
-
addValuesAt
public DataSet addValuesAt(int row, Object... values)
Description copied from interface:DataSetAdd a row at the given position.- Specified by:
addValuesAtin interfaceDataSet- Parameters:
row- The cell row (the first row is 0).
-
addValues
public DataSet addValues(Object... values)
Description copied from interface:DataSetAdd a row at the end of the data set.
-
_setValuesAt
protected void _setValuesAt(int row, boolean insert, Object... values)
-
addEmptyRowAt
public DataSet addEmptyRowAt(int row)
Description copied from interface:DataSetAdd an empty row at the given position.- Specified by:
addEmptyRowAtin interfaceDataSet- Parameters:
row- The cell row (the first row is 0).
-
_setEmptyRowAt
protected void _setEmptyRowAt(int row, boolean insert)
-
convert
public Object convert(DataColumn column, Object value)
-
trim
public DataSet trim(int offset, int rows)
Description copied from interface:DataSetReturns a data set containing only the specified row sub set.
-
trim
public DataSet trim(List<Integer> rows)
Description copied from interface:DataSetReturns a data set containing only the specified row sub set.
-
cloneEmpty
public DataSetImpl cloneEmpty()
Description copied from interface:DataSetBuild a data set with the same structure as this but containing no data.- Specified by:
cloneEmptyin interfaceDataSet
-
cloneInstance
public DataSetImpl cloneInstance()
Description copied from interface:DataSetBuild a data set with the same structure and content.- Specified by:
cloneInstancein interfaceDataSet
-
getEstimatedSize
public long getEstimatedSize()
Description copied from interface:DataSetReturn the estimated memory (in bytes) the data set is consuming.- Specified by:
getEstimatedSizein interfaceDataSet- Returns:
- The number of bytes
-
-