public class RowListStarTable extends RandomStarTable
The current implementation stores the data in a List of Object[] arrays - each list element contains the cells of one row of the table. Thus currently you can't store more than Integer.MAX_VALUE rows.
Some validation is performed when objects are inserted into the table, but it is possible to subvert this - the table itself can't guarantee that its data structures represent a legal table.
Constructor and Description |
---|
RowListStarTable(ColumnInfo[] colInfos)
Constructs a new RowListStarTable specifying the columns that it
will contain.
|
RowListStarTable(StarTable template)
Constructs a new RowListStarTable with its column and table metadata
copied from an existing table.
|
Modifier and Type | Method and Description |
---|---|
void |
addRow(Object[] values)
Adds a new row to the end of the table.
|
void |
clearRows()
Removes all rows from the table.
|
Object |
getCell(long lrow,
int icol)
Implementations of this method must be safe for concurrent calls
from multiple threads.
|
int |
getColumnCount()
Returns the number of columns in this table.
|
ColumnInfo |
getColumnInfo(int icol)
Returns the object describing the data in a given column.
|
Object[] |
getRow(long lrow)
The
AbstractStarTable implementation of this method
constructs a row by repeated invocation of AbstractStarTable.getCell(long, int) . |
long |
getRowCount()
Implementations must supply a non-negative return value.
|
void |
insertRow(long lrow,
Object[] values)
Adds a new row in the middle of the table.
|
void |
removeRow(long lrow)
Removes an existing row from the table.
|
void |
setCell(long lrow,
int icol,
Object value)
Sets the value of a given cell in the table.
|
void |
setRow(long lrow,
Object[] values)
Sets the value of a given row in the table.
|
getRowAccess, getRowSequence, isRandom
checkedLongToInt, close, getColumnAuxDataInfos, getName, getParameters, getRowSplittable, getURL, setName, setParameters, setURL
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getParameterByName, setParameter
public RowListStarTable(ColumnInfo[] colInfos)
colInfos
- array of objects defining the columns of the tablepublic RowListStarTable(StarTable template)
template
is ignored.template
- template table supplying column and table metadatapublic long getRowCount()
RandomStarTable
getRowCount
in interface StarTable
getRowCount
in class RandomStarTable
public int getColumnCount()
StarTable
getColumnCount
in interface StarTable
getColumnCount
in class AbstractStarTable
public ColumnInfo getColumnInfo(int icol)
StarTable
getColumnInfo
in interface StarTable
getColumnInfo
in class AbstractStarTable
icol
- the column for which header information is requiredicol
public Object getCell(long lrow, int icol)
RandomStarTable
getCell
in interface StarTable
getCell
in class RandomStarTable
lrow
- the index of the cell's rowicol
- the index of the cell's columnpublic Object[] getRow(long lrow)
AbstractStarTable
AbstractStarTable
implementation of this method
constructs a row by repeated invocation of AbstractStarTable.getCell(long, int)
.getRow
in interface StarTable
getRow
in class AbstractStarTable
lrow
- the index of the row to retrieveirow
public void setCell(long lrow, int icol, Object value)
value
has to have a class compatible with its column.lrow
- row indexicol
- column indexvalue
- new value for the cell at
lrow
, icol
IllegalArgumentException
- if value
is not
compatible with column icol
public void setRow(long lrow, Object[] values)
values
has to have the same number of elements as there
are columns in this table, and its elements have to have classes
compatible with the table columns.lrow
- row indexvalues
- new values for the cells in row lrow
IllegalArgumentException
- if values
has the wrong
number of elements or they are of the wrong classpublic void addRow(Object[] values)
values
has to have the same number of elements as there
are columns in this table, and its elements have to have classes
compatible with the table columns.values
- values for the cells in the new rowIllegalArgumentException
- if values
has the wrong
number of elements or they are of the wrong classpublic void insertRow(long lrow, Object[] values)
lrow
will be shoved down by one.
values
has to have the same number of elements as there
are columns in this table, and its elements have to have classes
compatible with the table columns.lrow
- row index for the new rowvalues
- values for the cells in the new rowIllegalArgumentException
- if values
has the wrong
number of elements or they are of the wrong classpublic void removeRow(long lrow)
lrow
will be moved up by one.lrow
- index of the row to removepublic void clearRows()
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.