de.erichseifert.gral.data
Interface MutableDataSource
-
- All Superinterfaces:
- DataSource, java.lang.Iterable<java.lang.Comparable<?>>
- All Known Implementing Classes:
- DataTable
public interface MutableDataSource extends DataSource
Interface for write access to tabular data. The access includes adding, modifying, and deleting of the data.
All data can be sorted row-wise with the method
sort(DataComparator...). For example, this way column 1 could be sorted ascending and column 3 descending.- See Also:
DataSource
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description intadd(java.lang.Comparable<?>... values)Adds a row with the specified comparable values.intadd(java.util.List<? extends java.lang.Comparable<?>> values)Adds a row with the specified container's elements to the data sink.intadd(Row row)Adds the specified row to the data sink.voidclear()Deletes all rows this data sink contains.voidremove(int row)Removes a specified row from the data sink.voidremoveLast()Removes the last row from the data sink.<T> java.lang.Comparable<T>set(int col, int row, java.lang.Comparable<T> value)Sets the value of a cell specified by its column and row indexes.voidsetName(java.lang.String name)Sets the name of this series.voidsort(DataComparator... comparators)Sorts the data sink rows with the specified sorting rules.-
Methods inherited from interface de.erichseifert.gral.data.DataSource
addDataListener, get, getColumn, getColumnCount, getColumnStatistics, getColumnTypes, getName, getRecord, getRow, getRowCount, getRowStatistics, getStatistics, isColumnNumeric, removeDataListener
-
-
-
-
Method Detail
-
add
int add(java.lang.Comparable<?>... values)
Adds a row with the specified comparable values. The values are added in the order they are specified. If the types of the data sink columns and the values do not match, anIllegalArgumentExceptionis thrown.- Parameters:
values- values to be added as a row.- Returns:
- Index of the row that has been added.
-
add
int add(java.util.List<? extends java.lang.Comparable<?>> values)
Adds a row with the specified container's elements to the data sink. The values are added in the order they are specified. If the types of the data sink columns and the values do not match, anIllegalArgumentExceptionis thrown.- Parameters:
values- values to be added as a row.- Returns:
- Index of the row that has been added.
-
add
int add(Row row)
Adds the specified row to the data sink. The values are added in the order they are specified. If the types of the data sink columns and the values do not match, anIllegalArgumentExceptionis thrown.- Parameters:
row- Row to be added.- Returns:
- Index of the row that has been added.
-
remove
void remove(int row)
Removes a specified row from the data sink.- Parameters:
row- Index of the row to remove.
-
removeLast
void removeLast()
Removes the last row from the data sink.
-
clear
void clear()
Deletes all rows this data sink contains.
-
set
<T> java.lang.Comparable<T> set(int col, int row, java.lang.Comparable<T> value)Sets the value of a cell specified by its column and row indexes.- Type Parameters:
T- Data type of the cell.- Parameters:
col- Column of the cell to change.row- Row of the cell to change.value- New value to be set.- Returns:
- Old value that was replaced.
-
sort
void sort(DataComparator... comparators)
Sorts the data sink rows with the specified sorting rules. The row values are compared in the way the comparators are specified.- Parameters:
comparators- Comparators used for sorting.
-
setName
void setName(java.lang.String name)
Sets the name of this series.- Parameters:
name- name to be set
-
-
DataMelt 3.0 © DataMelt by jWork.ORG