com.sas.table
Interface RowTemplateTableInterface

All Superinterfaces:
StaticRowTemplateTableInterface, StaticTableInterface, TableInterface
All Known Subinterfaces:
DataTableInterface
All Known Implementing Classes:
JDBCToDataTableAdapter

public interface RowTemplateTableInterface
extends StaticRowTemplateTableInterface, TableInterface

Defines an interface for modifying row template tables. Row template tables are tables where the set of column classes defines a template for each row. In other words, the class of each cell is restricted to the class, or a subclass, of its corresponding column. A SAS data set is an example of such a table.

See Also:
ColumnTemplateTableInterface, FreeformTableInterface

Field Summary
static int DEFAULT_INDEX
          Default index constant.
 
Method Summary
 void addColumn(int index, java.lang.Class cellClass, java.lang.Object defaultValue)
          Adds a column.
 void addRow(int index)
          Adds a default row.
 void addRow(int index, java.lang.Object[] values)
          Adds a row.
 void deleteColumn(int index)
          Deletes a column.
 void deleteRow(int index)
          Deletes a row.
 java.lang.Object getColumnDefaultValue(int index)
          Returns the default value associated with a column.
 java.lang.Object[] getColumnDefaultValues(int startIndex, int count)
          Returns the default values associated with a range of columns.
 boolean isColumnsDeletable()
          Returns the value of the columnsDeletable property.
 boolean isColumnsExtendable()
          Returns the value of the columnsExtendable property.
 boolean isColumnsInsertable()
          Returns the value of the columnsInsertable property.
 boolean isColumnsRedefinable()
          Returns the value of the columnsRedefinable property.
 boolean isRowsDeletable()
          Returns the value of the rowsDeletable property.
 boolean isRowsExtendable()
          Returns the value of the rowsExtendable property.
 boolean isRowsInsertable()
          Returns the value of the rowsInsertable property.
 void setColumnClass(int index, java.lang.Class newValue)
          Sets the class of a column.
 void setColumnDefaultValue(int index, java.lang.Object newValue)
          Sets the default value associated with a column.
 
Methods inherited from interface com.sas.table.StaticRowTemplateTableInterface
getColumnClass, getColumnClasses
 
Methods inherited from interface com.sas.table.TableInterface
isCellsModifiable, isMultipleColumnUpdateSupported, isMultipleRowUpdateSupported, setCell, setCells, setColumn, setRow
 
Methods inherited from interface com.sas.table.StaticTableInterface
countColumns, countRows, getCell, getCellClass, getCellClasses, getCells, getColumn, getColumnCount, getRow, getRowCount
 

Field Detail

DEFAULT_INDEX

static final int DEFAULT_INDEX
Default index constant. Use as the index with addRow and addColumn to add at the default position (usually the end).

See Also:
Constant Field Values
Method Detail

addColumn

void addColumn(int index,
               java.lang.Class cellClass,
               java.lang.Object defaultValue)
               throws com.sas.table.TableException
Adds a column. The new column is inserted at the given index and assigned the given class and defaultValue.

Some implementations may not allow columns to be added. This can be determined through isColumnsExtendable. Some implementations may allow columns to be added, but not inserted; check isColumnsInsertable. If this is the case, only DEFAULT_INDEX can be specified for index.

Parameters:
index - The one-based position at which to insert the column; columns already at or above that position will be shifted-up. If DEFAULT_INDEX is specified the position of the new column is implementation defined, but should be at the end if possible.
cellClass - The class of the column's cells.
defaultValue - The default value for the column's cells.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

deleteColumn

void deleteColumn(int index)
                  throws com.sas.table.TableException
Deletes a column. The column is identified by the given index.

Some implementations may not allow columns to be deleted. This can be determined through isColumnsDeletable.

Parameters:
index - A one-based index that identifies the column.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.
java.lang.IndexOutOfBoundsException - Thrown if index is negative, zero, or greater than the number of columns.

getColumnDefaultValue

java.lang.Object getColumnDefaultValue(int index)
                                       throws com.sas.table.TableException
Returns the default value associated with a column. The column is identified by the given index. The default value is used as the value for cells in the column which are not assigned values of their own.

Parameters:
index - A one-based index that identifies the column.
Returns:
The column's default value.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.
java.lang.IndexOutOfBoundsException - Thrown if index is negative, zero, or greater than the number of columns.

getColumnDefaultValues

java.lang.Object[] getColumnDefaultValues(int startIndex,
                                          int count)
                                          throws com.sas.table.TableException
Returns the default values associated with a range of columns. The range of columns is identified by the given index which serves to identify a starting column and by the given column count which defines the extent of the range. The set of default values is returned as an array with each element of the array corresponding to a column in the range.

Parameters:
startIndex - A one-based index which identifies the start of the range.
count - The number of default values to return; defines the extent of the range.
Returns:
The specified columns' default values.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.
java.lang.IndexOutOfBoundsException - Thrown if startIndex or count is negative, zero, or greater than the number of columns except when getColumnCount has returned -1. In that case, the implementation should return an array whose length is less than count and the caller should be prepared for this.

isColumnsDeletable

boolean isColumnsDeletable()
                           throws com.sas.table.TableException
Returns the value of the columnsDeletable property. columnsDeletable indicates whether or not columns can be deleted; see deleteColumn.

Returns:
True if columns can be deleted, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

isColumnsExtendable

boolean isColumnsExtendable()
                            throws com.sas.table.TableException
Returns the value of the columnsExtendable property. columnsExtendable indicates whether or not the set of columns can be extended or added to; see addColumn.

Returns:
True if new columns can be added, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

isColumnsInsertable

boolean isColumnsInsertable()
                            throws com.sas.table.TableException
Returns the value of the columnsInsertable property. columnsInsertable indicates whether or not new columns can be inserted into the existing set; see addColumn.

Returns:
True if new columns can be inserted, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

isColumnsRedefinable

boolean isColumnsRedefinable()
                             throws com.sas.table.TableException
Returns the value of the columnsRedefinable property. columnsRedefinable indicates whether or not columns can be redefined; see setColumnClass.

Returns:
True if columns can be redefined, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

setColumnDefaultValue

void setColumnDefaultValue(int index,
                           java.lang.Object newValue)
                           throws com.sas.table.TableException
Sets the default value associated with a column. The column is identified by the given index. The default value is used as the value for cells in the column which are not assigned values of their own.

Parameters:
index - A one-based index that identifies the column.
newValue - The new defaultValue to associate with the column.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.
java.lang.IndexOutOfBoundsException - Thrown if index is negative, zero, or greater than the number of columns.

setColumnClass

void setColumnClass(int index,
                    java.lang.Class newValue)
                    throws com.sas.table.TableException
Sets the class of a column. The column is identified by the given index. Since all columns are assigned a class when they are created (see addColumn), setting the class is equivalent to redefining the column. The class may be relaxed, restricted, or changed entirely depending on the flexibility of the implementation. An example of relaxing the class is changing a column of Strings to be a column of Objects. Restricting the class is shown by changing a column of Doubles to be Integers.

Some implementations may not allow columns to be redefined. This can be determined through isColumnsRedefinable.

Parameters:
index - A one-based index that identifies the column.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.
java.lang.IndexOutOfBoundsException - Thrown if index is negative, zero, or greater than the number of columns.

addRow

void addRow(int index,
            java.lang.Object[] values)
            throws com.sas.table.TableException
Adds a row. The new row is inserted at the given index and its cells are assigned the given values. The class of each element in the values array must be the same as or derived from the class of its corresponding column.

Some implementations may not allow rows to be added. This can be determined through isRowsExtendable. Some implementations may allow rows to be added, but not inserted; check isRowsInsertable. If this is the case, only DEFAULT_INDEX can be specified for index.

Parameters:
index - The one-based position at which to insert the row; rows already at or above that position will be shifted-up. If DEFAULT_INDEX is specified the position of the new row is implementation defined, but should be at the end if possible.
values - The values for each of the row's cells.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

addRow

void addRow(int index)
            throws com.sas.table.TableException
Adds a default row. The new row is inserted at the given index and its cells are assigned the default value associated with their column.

Some implementations may not allow rows to be added. This can be determined through isRowsExtendable. Some implementations may allow rows to be added, but not inserted; check isRowsInsertable. If this is the case, only DEFAULT_INDEX can be specified for index.

Parameters:
index - The one-based position at which to insert the row; rows already at or above that position will be shifted-up. If DEFAULT_INDEX is specified the position of the new row is implementation defined, but should be at the end if possible.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

isRowsExtendable

boolean isRowsExtendable()
                         throws com.sas.table.TableException
Returns the value of the rowsExtendable property. rowsExtendable indicates whether or not the set of rows can be extended or added to; see addRow.

Returns:
True if new rows can be added, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

isRowsInsertable

boolean isRowsInsertable()
                         throws com.sas.table.TableException
Returns the value of the rowsInsertable property. rowsInsertable indicates whether or not new rows can be inserted into the existing set; see addRow.

Returns:
True if new rows can be inserted, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.

deleteRow

void deleteRow(int index)
               throws com.sas.table.TableException
Deletes a row. The row is identified by the given index.

Some implementations may not allow rows to be deleted. This can be determined through isRowsDeletable.

Parameters:
index - A one-based index that identifies the row.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.
java.lang.IndexOutOfBoundsException - Thrown if index is negative, zero, or greater than the number of rows.

isRowsDeletable

boolean isRowsDeletable()
                        throws com.sas.table.TableException
Returns the value of the rowsDeletable property. rowsDeletable indicates whether or not rows can be deleted; see deleteRow.

Returns:
True if rows can be deleted, false otherwise.
Throws:
TableException - Provides a catch-all for all non-RuntimeExceptions.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.