|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StaticTableInterface
Defines an interface for accessing two-dimensional data.
Two-dimensional data is commonly referred to as rectangular or tabular data, or simply as "table". Tables are composed of a horizontal dimension -- "the columns" -- and a vertical dimension -- "the rows". The intersection of a column with a row is called a "cell". Some common examples of tables are SAS datasets, ODBC and JDBC databases, two-dimensional arrays, and spreadsheets. Classes which implement StaticTableInterface are known as "table models".
StaticTableInterface defines methods for retrieving the number and class of columns, the number and class of rows, and the class and value of cells. Methods for adding and deleting rows and columns, and modifying cells are left to an extended interface (see TableInterface), hence the inclusion of "static" in the interface name. Methods dealing with additional metadata, including column and row labels, are also left to other interfaces to define.
The data returned by this interface (i.e. getCell()) is assumed to be unformatted or raw data hence the use of the Object class to categorize it. If your table also has formatted data of class String, then also implement StaticFormattedDataInterface.
Most of StaticTableInterface's methods have index parameters. All of
these indices are one-based. For example, to get the class of the first
column use getColumnClass(1)
. Array parameters, including returned
arrays, use zero-based indexing as usual.
StaticFormattedDataInterface
,
StaticColumnLabelInterface
,
StaticRowLabelInterface
,
TableInterface
,
TableView
Method Summary | |
---|---|
int |
countColumns(int maxCount)
Counts the columns. |
int |
countRows(int maxCount)
Counts the rows. |
java.lang.Object |
getCell(int rowIndex,
int columnIndex)
Returns the value of a cell. |
java.lang.Class |
getCellClass(int rowIndex,
int columnIndex)
Returns the class of a cell. |
java.lang.Class[][] |
getCellClasses(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount)
Returns the classes for a block of cells. |
java.lang.Object[][] |
getCells(int startRowIndex,
int startColumnIndex,
int rowCount,
int columnCount)
Returns the values for a block of cells. |
java.lang.Object[] |
getColumn(int index)
Returns the values of all the cells in a column. |
int |
getColumnCount()
Returns the number of columns available. |
java.lang.Object[] |
getRow(int index)
Returns the values of all the cells in a row. |
int |
getRowCount()
Returns the number of rows available. |
Method Detail |
---|
int countColumns(int maxCount) throws com.sas.table.TableException
countColumns() is an instruction to determine the number of columns even though that number is not readily known. To limit the potential overhead of this determination, the maximum number of columns to read may be specified.
maxCount
- Maximum number of columns to read, or 0 to read indefinitely.
Implementations where the number of columns is always known should
ignore this parameter. In cases where the total number of columns
is unknown, but the number known so far is greater than maxCount
should return the larger known number. Thus maxCount is only
used as a limiting factor when the implementation has to actually do
computation (e.g. fetch observations).
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).getColumnCount()
,
StaticTableInterfaceSupport.countColumns(com.sas.table.StaticTableInterface, int)
int countRows(int maxCount) throws com.sas.table.TableException
countRows() is an instruction to determine the number of rows even though that number is not readily known. To limit the potential overhead of this determination, the maximum number of rows to read may be specified.
maxCount
- Maximum number of rows to read, or 0 to read indefinitely.
Implementations where the number of rows is always known should
ignore this parameter. In cases where the total number of rows
is unknown, but the number known so far is greater than maxCount
should return the larger known number. Thus maxCount is only
used as a limiting factor when the implementation has to actually do
computation (e.g. fetch observations).
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).getRowCount()
,
StaticTableInterfaceSupport.countRows(com.sas.table.StaticTableInterface, int)
java.lang.Object getCell(int rowIndex, int columnIndex) throws com.sas.table.TableException
rowIndex
- A one-based index that identifies the cell's row.columnIndex
- A one-based index that identifies the cell's column.
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).
java.lang.IndexOutOfBoundsException
- Thrown if rowIndex is negative, zero, or greater than the
number of rows.
Thrown if columnIndex is negative, zero, or greater than the
number of columns.getCells(int, int, int, int)
,
getColumn(int)
,
getRow(int)
java.lang.Object[][] getCells(int startRowIndex, int startColumnIndex, int rowCount, int columnCount) throws com.sas.table.TableException
new Object[rowCount][colCount]
, with
values[0][0]
containing the value of the cell at
(startRowIndex, startColumnIndex).
startRowIndex
- A one-based index that identifies the start of the row range.startColumnIndex
- A one-based index that identifies the start of the column range.rowCount
- The number of rows in the row range.columnCount
- The number of columns in the column range.
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).
java.lang.IndexOutOfBoundsException
- Thrown if startRowIndex or rowCount is negative,
zero, or greater than the number of rows; except when
getRowCount() has returned -1 -- in that case, the
implementation should reduce rowCount appropriately and
the caller should be prepared for a smaller returned array.
Thrown if startColumnIndex or columnCount is negative,
zero, or greater than the number of columns; except when
getColumnCount() has returned -1 -- in that case, the
implementation should reduce columnCount appropriately and
the caller should be prepared for a smaller returned array.getCell(int, int)
,
StaticTableInterfaceSupport.getCells(com.sas.table.StaticTableInterface, int, int, int, int)
java.lang.Class getCellClass(int rowIndex, int columnIndex) throws com.sas.table.TableException
rowIndex
- A one-based index that identifies the cell's row.columnIndex
- A one-based index that identifies the cell's column.
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).
java.lang.IndexOutOfBoundsException
- Thrown if rowIndex is negative, zero, or greater than the
number of rows.
Thrown if columnIndex is negative, zero, or greater than the
number of columns.getCellClasses(int, int, int, int)
java.lang.Class[][] getCellClasses(int startRowIndex, int startColumnIndex, int rowCount, int columnCount) throws com.sas.table.TableException
new Class[rowCount][colCount]
, with
clases[0][0]
containing the class of the cell at
(startRowIndex, startColumnIndex).
startRowIndex
- A one-based index that identifies the start of the row range.startColumnIndex
- A one-based index that identifies the start of the column range.rowCount
- The number of rows in the row range.columnCount
- The number of columns in the column range.
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).
java.lang.IndexOutOfBoundsException
- Thrown if startRowIndex or rowCount is negative,
zero, or greater than the number of rows; except when
getRowCount() has returned -1 -- in that case, the
implementation should reduce rowCount appropriately and
the caller should be prepared for a smaller returned array.
Thrown if startColumnIndex or columnCount is negative,
zero, or greater than the number of columns; except when
getColumnCount() has returned -1 -- in that case, the
implementation should reduce columnCount appropriately and
the caller should be prepared for a smaller returned array.getCellClass(int, int)
,
StaticTableInterfaceSupport.getCellClasses(com.sas.table.StaticTableInterface, int, int, int, int)
java.lang.Object[] getColumn(int index) throws com.sas.table.TableException
index
- A one-based index that identifies the column.
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).
java.lang.IndexOutOfBoundsException
- Thrown if index is negative, zero, or greater than the number
of columns.getCell(int, int)
,
StaticTableInterfaceSupport.getColumn(com.sas.table.StaticTableInterface, int)
int getColumnCount() throws com.sas.table.TableException
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).countColumns(int)
java.lang.Object[] getRow(int index) throws com.sas.table.TableException
index
- A one-based index that identifies the row.
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).
java.lang.IndexOutOfBoundsException
- Thrown if index is negative, zero, or greater than the number
of rows.getCell(int, int)
,
StaticTableInterfaceSupport.getRow(com.sas.table.StaticTableInterface, int)
int getRowCount() throws com.sas.table.TableException
TableException
- Thrown if the query can not be satisfied (e.g. i/o-failure).countRows(int)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |