com.sas.models
Class SimpleTable

com.sas.models.SimpleTable
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.collection.ContentsChangedSource, ComponentInterface, LinkPropertiesInterface, ModelInterface, com.sas.PublicClonable, ColumnLabelInterface, RowLabelInterface, RowTemplateTableInterface, SortableTableInterface, StaticColumnLabelInterface, com.sas.table.StaticRowLabelInterface, StaticRowTemplateTableInterface, StaticTableInterface, StaticTableStyleInterface, TableInterface, com.sas.util.EventGateInterface, ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
IMDBTable

public class SimpleTable
implements com.sas.PublicClonable, RowLabelInterface, ColumnLabelInterface, RowTemplateTableInterface, com.sas.collection.ContentsChangedSource, com.sas.util.EventGateInterface, StaticTableStyleInterface, SortableTableInterface

SimpleTable manages any two-dimensional data where all the columns are of uniform type. It implements the two-dimensional data interfaces which define access and updates to the data.

SimpleTable defines row template style data, where the set of column classes defines a template, or signature, for each of the rows. All cells within a column are assumed to be of uniform type.

The SimpleTable model is designed for simple definition of two-dimensional data. The data is stored in memory within the model, and has nothing to do with data sets. To manage two-dimensional data within a dataset, use the DataSetInterface class.

To use the SimpleTable model, simply start defining columns and adding rows with the appropriate data.

Creating a SimpleTable model
 

The following example creates a model with weather information for each day of the week.

// Make an instance of the SimpleTable object SimpleTable weather = new SimpleTable(); weather.initialize();

// Define the columns for the model // Add the column for the daily forecast weather.addColumn(1, java.lang.String.class, null); weather.setColumnLabel(1, "Forecast"); // Add the column for the temperature weather.addColumn(2, java.lang.Double.class, null); weather.setColumnLabel(2, "High temperature"); // Add the rows for Friday, Saturday, and Sunday // Add a row using the addRow and setCell methods weather.addRow(1); weather.setRowLabel(1, "Friday"); weather.setCell(1, 1, "Sunny"); weather.setCell(1, 2, new Double(76.2)); // Add a row using the addRow method with cell arguments Object[] saturday = new Object[2]; saturday[0] = "Cloudy"; saturday[1] = new Double(56.7); weather.addRow(2, saturday); weather.setRowLabel(2, "Saturday"); // Add a row using the addRow and setRow methods Object[] sunday = new Object[2]; sunday[0] = "Stormy"; sunday[1] = new Double(52.3); weather.addRow(3); weather.setRowLabel(3, "Sunday"); weather.setRow(3, sunday);

See Also:
Rocf, DataSetInterface, Serialized Form

Field Summary
protected  com.sas.collection.ContentsChangedListenerList allContentsChangedListeners
          allContentsChangedListeners is a list of listeners for the com.sas.util.ContentsChangedEvent event.
protected  boolean columnLabelsSupported
          Whether or not column labels are supported
protected  java.lang.Object columnsLabel
          The columns label
protected  boolean columnsLabelSupported
          Whether or not the columns label is supported
protected  boolean rowLabelsSupported
          Whether or not row labels are supported
protected  java.lang.Object rowsLabel
          The rows label
protected  boolean rowsLabelSupported
          Whether or not the rows label is supported
 
Fields inherited from interface com.sas.table.RowTemplateTableInterface
DEFAULT_INDEX
 
Constructor Summary
SimpleTable()
          Default constructor, creates an empty table (no rows, no columns).
SimpleTable(DataTableInterface table)
          Construct a SimpleTable using an existing table
SimpleTable(DataTableInterface table, java.util.Comparator[] comparators)
          Construct a sortable SimpleTable using an existing table.
SimpleTable(DataTableInterface table, int startRow, int endRow, int startCol, int endCol)
          Construct a SimpleTable using an existing table with the specified rows and columns
SimpleTable(DataTableInterface table, int startRowIndex, int endRowIndex, int startCol, int endCol, java.util.Comparator[] comparators)
          Construct a sortable SimpleTable using an existing table with the specified rows and columns
SimpleTable(int numRows, int numColumns)
          Construct a SimpleTable with an initial number of rows and columns.
SimpleTable(int numRows, int numColumns, java.util.Comparator[] comparators)
          Construct a SimpleTable with an initial number of rows and columns.
 
Method Summary
 void addColumn(int columnIndex)
          Add a default column at columnIndex The column type will be Object and the default value will be null.
 void addColumn(int columnIndex, java.lang.Class type, java.lang.Object defaultValue)
          The specified default value will be used to set the value of every cell in the new column.
 void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
          Add a listener for the com.sas.util.ContentsChangedEvent event.
 void addRow(int rowIndex)
          The row will be filled in with the default values for each column.
 void addRow(int rowIndex, java.lang.Object[] values)
          Adds a row.
protected  boolean anyContentsChangedListeners()
          Test is there is any registered event listener for a ContentsChangedEvent, or any registered PropertyChangeEvent.
protected  int calculateTotalColumns(DataTableInterface dti)
          Calculate the total number of columns in the data table
protected  int calculateTotalRows(DataTableInterface dti)
          Calculate the total number of rows in the data table
 java.lang.Object clone()
          Clone the simple table object
 int countColumns(int maxColumnCount)
          This model does not handle the maxColumnCount argument and will always return getColumnCount()
 int countRows(int maxRowCount)
          This model does not handle the maxRowCount argument and will always return getRowCount()
 void deleteAllColumns()
          deleteAllColumns is a convenience method which deletes all the column definitions in the table.
 void deleteAllRows()
          deleteAllRows is a convenience method which deletes all the rows in the table.
 void deleteColumn(int columnIndex)
          Deleting the column will delete any associated column labels as well.
 void deleteRow(int rowIndex)
          Deleting the row will delete any associated row labels as well.
 void deleteRows(boolean[] delete)
          Delete rows between startRowIndex and endRowIndex as indicated in a vector of flags.
 void disableEvents()
          Suspends sending of ContentsChangedEvent, which otherwise would be sent on every update method call, such as setCell or addColumn.
 void enableEvents()
          Resumes sending of ContentsChangedEvent, which otherwise would be sent on every update method call, such as setCell or addColumn.
protected  void enableEvents(com.sas.collection.ContentsChangedEvent e)
          Resumes sending of ContentsChangedEvent, which otherwise would be sent on every update method call, such as setCell or addColumn.
 boolean equals(java.lang.Object o)
          implementation of Object.equals(Object).
 boolean equals(SimpleTable table)
          Compare this SimpleTable to another SimpleTable
protected  void fireContentsChanged()
          Fire a default contents changed event.
protected  void fireContentsChanged(com.sas.collection.ContentsChangedEvent event)
          Send a ContentsChangedEvent event to all the ContentsChangedListener objects in the listener list.
 java.lang.Object getCell(int rowIndex, int columnIndex)
          Returns the value of a cell.
static java.lang.Object getCell(java.lang.Object row, int columnIndex)
          Extracts the desired cell from a table row using This static method should be used for row based comparators (for either sorting or removing duplicates).
 java.lang.Class getCellClass(int rowIndex, int columnIndex)
          Returns the specific class for each individual 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.
 StaticPropertyBagInterface getCellStyle(int rowIndex, int colIndex)
          Throws an exception since SimpleTable does not support styles on a per-cell basis at this time.
 java.lang.Object[] getColumn(int columnIndex)
          Returns the values of all the cells in a column.
 java.lang.Class getColumnClass(int columnIndex)
          Returns the class of a column.
 java.lang.Class[] getColumnClasses()
           
 java.lang.Class[] getColumnClasses(int startColumnIndex, int columnCount)
          Returns the classes for a range of columns.
 java.util.Comparator getColumnComparator(int columnIndex)
          Return the comparator associated with this column.
 int getColumnCount()
          Returns the number of columns available.
 java.lang.Object getColumnDefaultValue(int columnIndex)
          Returns the default value associated with a column.
 java.lang.Object[] getColumnDefaultValues(int startColumnIndex, int columnCount)
          Returns the default values associated with a range of columns.
 java.lang.Object getColumnLabel(int columnIndex)
          Returns the label for a column.
 java.lang.Object[] getColumnLabels(int startColumnIndex, int columnCount)
          Returns the labels for a range of columns.
 StaticPropertyBagInterface getColumnLabelStyle(int colIndex)
          Throws an exception since SimpleTable does not support styles on a per-column-label basis at this time.
 StaticPropertyBagInterface getColumnStyle(int colIndex)
          Throws an exception since SimpleTable does not support styles on a per-column basis at this time.
 StaticPropertyBagInterface getDefaultCellStyle()
          Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for cells.
 StaticPropertyBagInterface getDefaultColumnStyle()
          Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for columns.
 StaticPropertyBagInterface getDefaultLabelStyle()
          Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for labels.
 StaticPropertyBagInterface getDefaultRowStyle()
          Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for rows.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
 java.lang.Object[] getRow(int rowIndex)
          Returns the values of all the cells in a row.
 int getRowCount()
          Returns the number of rows available.
 java.lang.Object getRowLabel(int rowIndex)
           
 java.lang.Object[] getRowLabels(int startRowIndex, int rowCount)
           
 StaticPropertyBagInterface getRowLabelStyle(int rowIndex)
          Throws an exception since SimpleTable does not support styles on a per-row-label basis at this time.
 StaticPropertyBagInterface getRowStyle(int rowIndex)
          Throws an exception since SimpleTable does not support styles on a per-row basis at this time.
 boolean isCellsModifiable()
          In this model, the cells are always modifiable, so this method always returns true.
 boolean isCellStylesSupported()
          Returns false since SimpleTable does not support styles a per-cell basis at this time.
 boolean isColumnLabelsModifiable()
          Indicates whether column labels can be modified.
 boolean isColumnLabelsSupported()
          Indicates whether getColumnLabel() and getColumnLabels() should be called.
 boolean isColumnLabelStylesSupported()
          Returns false since SimpleTable does not support styles a per-column-label basis at this time.
 boolean isColumnsDeletable()
          In this model, the columns can always be deleted, so this method will always return true.
 boolean isColumnsExtendable()
          In this model, the columns list can always be extended, so this method will always return true.
 boolean isColumnsInsertable()
          In this model, new columns can always be inserted, so this method will always return true.
 boolean isColumnsLabelSupported()
          Indicates whether there is support for a column labels label, i.e. a label for the set of column labels taken as a whole.
 boolean isColumnsRedefinable()
          In this model, column types can always be redefined, so this method will always return true.
 boolean isColumnStylesSupported()
          Returns false since SimpleTable does not support styles a per-column basis at this time.
 boolean isMultipleColumnUpdateSupported()
          In this model, multiple column update is always supported, so this method always returns true.
 boolean isMultipleRowUpdateSupported()
          In this model, multiple row update is always supported, so this method always returns true.
 boolean isRowLabelsModifiable()
          Indicates whether row labels can be modified.
 boolean isRowLabelsSupported()
           
 boolean isRowLabelStylesSupported()
          Returns false since SimpleTable does not support styles a per-row-label basis at this time.
 boolean isRowsDeletable()
          In this model, rows can always be deleted, so this method will always return true.
 boolean isRowsExtendable()
          In this model, the rows list can always be extended, so this method will always return true.
 boolean isRowsInsertable()
          In this model, new rows can always be inserted, so this method will always return true.
 boolean isRowsLabelSupported()
           
 boolean isRowStylesSupported()
          Returns false since SimpleTable does not support styles a per-row basis at this time.
protected  java.util.Comparator newColumnComparator(int col, java.util.Comparator comparator)
          Returns the column comparator for the column col or if it is null, return ConstantComparator.COMPARE_EQUALS
 java.util.Comparator newCompositeComparator(int[] columnIndices, java.util.Comparator[] comparators)
          Return a CompositeComparator that compares using the comparators or, if any element of comparators column comparators is null, the corresponding column comparator.
protected  java.util.Comparator newRowComparator()
           
 int normalizeEndRow(int rowNumber)
           
 int normalizeStartRow(int rowNumber)
           
 void permute(int[] permutation)
          Permute a table according to a permutation array.
 void populate(DataTableInterface dti)
          Populate a SimpleTable using an existing table.
protected  void populate(DataTableInterface dti, boolean defineColumns)
          Populate a SimpleTable using an existing table
 void populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol)
          Populate a SimpleTable using an existing table with the specified row and column parameters
 void populate(DataTableInterface dti, int startCol, int endCol)
          Populate a SimpleTable using an existing table with the specified column parameters
 void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
          Remove a listener for the com.sas.util.ContentsChangedEvent event.
 void removeDuplicates(java.util.Comparator comparator)
          Remove duplicates from a sorted table, based on comparing the row contents.
 void removeDuplicates(java.util.Comparator comparator, int startRowIndex, int endRowIndex, boolean keepFirst, boolean[] removed)
          Remove duplicates from a sorted table, based on comparing the row contents.
 void removeDuplicates(int[] columnIndices, java.util.Comparator[] comparators)
          Remove duplicates from a sorted table, based on comparing cell contents from multiple columns.
 void removeDuplicates(int[] columnIndices, java.util.Comparator[] comparators, int startRowIndex, int endRowIndex, boolean keepFirst, boolean[] removed)
          Remove duplicates from a sorted table, based on comparing cell contents from multiple columns.
 void removeDuplicates(int columnIndex, java.util.Comparator comparator)
          Remove duplicates from a sorted table, based on comparing cell contents from a single column.
 void removeDuplicates(int columnIndex, java.util.Comparator comparator, int startRowIndex, int endRowIndex, boolean keepFirst, boolean[] removed)
          Remove duplicates from a sorted table, based on comparing cell contents from a single column.
protected  void removeWastedSpace()
          If there is wasted space in the internal vectors due to removing many rows or columns, reclaim it.
 void reverseColumnComparator(int columnIndex)
          Reverse the sense of the comparator for column columnIndex.
 void setCell(int rowIndex, int columnIndex, java.lang.Object data)
          Specifies the value of a cell.
 void setCells(int startRowIndex, int startColumnIndex, int rowCount, int columnCount, java.lang.Object[][] cells)
          Specifies the values for a block of cells.
 void setColumn(int columnIndex, java.lang.Object[] cells)
          Specifies the values of all the cells in a column.
 void setColumnClass(int columnIndex, java.lang.Class newValue)
          The column class is returned in the getColumnClass method.
 void setColumnComparator(int columnIndex, java.util.Comparator comparator)
           
 void setColumnComparators(java.util.Comparator[] comparators)
          Assign a set of comparators for sorting the table by columns.
 void setColumnCount(int numColumns)
          Set the number of columns
 void setColumnDefaultValue(int columnIndex, java.lang.Object newValue)
          The default column values apply only to subsequent calls to addRow or addColumn, and not to cell values that are already set.
 void setColumnLabel(int columnIndex, java.lang.Object label)
          Specifies the label to associate with a column.
 void setColumnLabelsSupported(boolean columnLabelsSupported)
           
 void setDefaultCellStyle(StaticPropertyBagInterface newValue)
          Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for cells.
 void setDefaultColumnStyle(StaticPropertyBagInterface newValue)
          Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for columns.
 void setDefaultLabelStyle(StaticPropertyBagInterface newValue)
          Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for labels.
 void setDefaultRowStyle(StaticPropertyBagInterface newValue)
          Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for rows.
 void setDefaultValues()
          Override the setDefaultValues method to initialize local variables
 void setRow(int rowIndex, java.lang.Object[] cells)
          Specifies the values of all the cells in a row.
 void setRowCount(int numRows)
          Set the number of rows
 void setRowLabel(int rowIndex, java.lang.Object label)
          Specifies the label to associate with a row.
 void setRowLabelsSupported(boolean rowLabelsSupported)
           
 void setSize(int rowCount, int colCount)
          Sets the size of this table.
 void sort(java.util.Comparator comparator, boolean removeDuplicates)
          Sort the table in place, based on comparing row contents using the comparator.
 void sort(java.util.Comparator comparator, int startRowIndex, int endRowIndex, int[] permutation)
          Sort the table in place, based on comparing row contents using the comparator.
 void sort(int[] columnIndices, java.util.Comparator[] comparators, boolean removeDuplicates)
          Sort the table in place, based on comparing elements from multiple columns listed in columnIndices, using the corresponding Comparator from the array, comparators.
 void sort(int[] columnIndices, java.util.Comparator[] comparators, int startRowIndex, int endRowIndex, int[] permutation)
          Sort the table in place, based on comparing elements from multiple columns listed in columnIndices, using the corresponding Comparator from the array, comparators.
 void sort(int columnIndex, java.util.Comparator comparator, boolean removeDuplicates)
          Sort the table in place, based on comparing elements from the column columnIndex, using the comparator.
 void sort(int columnIndex, java.util.Comparator comparator, int startRowIndex, int endRowIndex, int[] permutation)
          Sort the table in place, based on comparing elements from the column columnIndex, using the comparator.
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getRequiredInterfaces, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 

Field Detail

columnsLabelSupported

protected boolean columnsLabelSupported
Whether or not the columns label is supported


columnsLabel

protected java.lang.Object columnsLabel
The columns label


rowsLabelSupported

protected boolean rowsLabelSupported
Whether or not the rows label is supported


rowsLabel

protected java.lang.Object rowsLabel
The rows label


rowLabelsSupported

protected boolean rowLabelsSupported
Whether or not row labels are supported


columnLabelsSupported

protected boolean columnLabelsSupported
Whether or not column labels are supported


allContentsChangedListeners

protected transient com.sas.collection.ContentsChangedListenerList allContentsChangedListeners
allContentsChangedListeners is a list of listeners for the com.sas.util.ContentsChangedEvent event.

See Also:
addContentsChangedListener(com.sas.collection.ContentsChangedListener), removeContentsChangedListener(com.sas.collection.ContentsChangedListener), anyContentsChangedListeners()
Constructor Detail

SimpleTable

public SimpleTable()
Default constructor, creates an empty table (no rows, no columns). Use setSize, addRow, addColumns, setCells to build the table


SimpleTable

public SimpleTable(int numRows,
                   int numColumns)
Construct a SimpleTable with an initial number of rows and columns.

Parameters:
numRows - the initial number of rows.
numColumns - the initial number of columns.

SimpleTable

public SimpleTable(DataTableInterface table)
            throws com.sas.table.TableException
Construct a SimpleTable using an existing table

Parameters:
table - data table
Throws:
com.sas.table.TableException - Thrown by populate method called by constructor

SimpleTable

public SimpleTable(DataTableInterface table,
                   int startRow,
                   int endRow,
                   int startCol,
                   int endCol)
            throws com.sas.table.TableException
Construct a SimpleTable using an existing table with the specified rows and columns

Parameters:
table - data table
startRow - starting row (value must be greater than 0)
endRow - ending row (value must be greater than 0 and greater than or equal to the starting row). A value of -1 indicates the remaining rows of the table
startCol - starting column (value must be greater than 0)
endCol - ending column (value must be greater than 0 and greater than or equal to the starting column). A value of -1 indicates the remaining columns of the table
Throws:
com.sas.table.TableException - Thrown by populate method called by constructor

SimpleTable

public SimpleTable(DataTableInterface table,
                   java.util.Comparator[] comparators)
            throws com.sas.table.TableException
Construct a sortable SimpleTable using an existing table.

Parameters:
table - a table of data to populate this new SimpleTable from.
comparators - and array of comparators to associate with the columns. Element 1 of this array is the comparator for column 1, etc. Thus, element 0 is always ignored. Items beyond getColumnCount() are ignored.
Throws:
com.sas.table.TableException - when there is an exception reading data from table

SimpleTable

public SimpleTable(DataTableInterface table,
                   int startRowIndex,
                   int endRowIndex,
                   int startCol,
                   int endCol,
                   java.util.Comparator[] comparators)
            throws com.sas.table.TableException
Construct a sortable SimpleTable using an existing table with the specified rows and columns

Parameters:
table - a table of data to populate this new SimpleTable from.
comparators - and array of comparators to associate with the columns. Element 1 of this array is the comparator for column 1, etc. Thus, element 0 is always ignored. Items beyond getColumnCount() are ignored.
Throws:
com.sas.table.TableException - when there is an exception reading data from table

SimpleTable

public SimpleTable(int numRows,
                   int numColumns,
                   java.util.Comparator[] comparators)
Construct a SimpleTable with an initial number of rows and columns.

Parameters:
numRows - the initial number of rows.
numColumns - the initial number of columns.
comparators - and array of comparators to associate with the columns. Element 1 of this array is the comparator for column 1, etc. Thus, element 0 is always ignored. Items beyond getColumnCount() are ignored.
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

setColumnComparators

public void setColumnComparators(java.util.Comparator[] comparators)
Assign a set of comparators for sorting the table by columns.


populate

public void populate(DataTableInterface dti)
              throws com.sas.table.TableException
Populate a SimpleTable using an existing table. If the SimpleTable does not have columns defined, it will read the data table's column descriptors and create corresponding columns in the SimpleTable. If columns are defined, then data from the data table will be appended to the Simple Table (no changes/additions to the SimpleTable column definitions)

Parameters:
table - data table
Throws:
com.sas.table.TableException - Thrown (see populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol))
java.lang.IndexOutOfBoundsException - Thrown (see populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol))
java.lang.IllegalStateException - Thrown (see populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol))

populate

protected void populate(DataTableInterface dti,
                        boolean defineColumns)
                 throws com.sas.table.TableException
Populate a SimpleTable using an existing table

Parameters:
table - data table
defineColumns - indicates whether the SimpleTable should read the data table's column descriptors and create corresponding columns in the SimpleTable. If set to false, the SimpleTable will simply append the data from the data table (no changes/additions to the SimpleTable column definitions)
Throws:
com.sas.table.TableException - Thrown (see populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol))
java.lang.IndexOutOfBoundsException - Thrown (see populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol))
java.lang.IllegalStateException - Thrown (see populate(DataTableInterface dti, boolean defineColumns, int startRow, int endRow, int startCol, int endCol))

populate

public void populate(DataTableInterface dti,
                     boolean defineColumns,
                     int startRow,
                     int endRow,
                     int startCol,
                     int endCol)
              throws com.sas.table.TableException,
                     java.lang.IndexOutOfBoundsException,
                     java.lang.IllegalStateException
Populate a SimpleTable using an existing table with the specified row and column parameters

Parameters:
table - data table
defineColumns - indicates whether the SimpleTable should read the data table's column descriptors and create corresponding columns in the SimpleTable. If set to false, the SimpleTable will simply append the data from the data table (no changes/additions to the SimpleTable column definitions)
startRow - starting row (value must be greater than 0)
endRow - ending row (value must be greater than 0 and greater than or equal to the starting row). A value of -1 indicates the remaining rows of the table
startCol - starting column (value must be greater than 0)
endCol - ending column (value must be greater than 0 and greater than or equal to the starting column). A value of -1 indicates the remaining columns of the table
Throws:
java.lang.IndexOutOfBoundsException - Thrown if starting or ending row/column parameters are not valid (startRow/Column <=0, endRow/Column =0, endRow/Column < startRow/Column, endRow/Column <-1)
com.sas.table.TableException - Thrown if an attempt is made to add more columns to the SimpleTable and the value of defineColumns is false OR the column classes of the data table are not compatible with the current Simple Table column classes (defineColumns is specified as false)
java.lang.IllegalStateException - Thrown if columns are not defined in the Simple Table (defineColumns is specified as false)

populate

public void populate(DataTableInterface dti,
                     int startCol,
                     int endCol)
              throws com.sas.table.TableException,
                     java.lang.IndexOutOfBoundsException
Populate a SimpleTable using an existing table with the specified column parameters

Parameters:
table - data table
startCol - starting column (value must be greater than 0)
endCol - ending column (value must be greater than 0 and greater than or equal to the starting column). A value of -1 indicates the remaining columns of the table
Throws:
java.lang.IndexOutOfBoundsException - Thrown if starting or ending column parameters are not valid (startColumn <=0, endColumn =0, endColumn < startColumn, endColumn <-1)
com.sas.table.TableException - Thrown if the column classes of the data table are not compatible with the current Simple Table column classes

calculateTotalRows

protected int calculateTotalRows(DataTableInterface dti)
                          throws com.sas.table.TableException,
                                 java.lang.IndexOutOfBoundsException
Calculate the total number of rows in the data table

Parameters:
table - data table
Returns:
row count
Throws:
com.sas.table.TableException
java.lang.IndexOutOfBoundsException

calculateTotalColumns

protected int calculateTotalColumns(DataTableInterface dti)
                             throws com.sas.table.TableException
Calculate the total number of columns in the data table

Parameters:
table - data table
Returns:
column count
Throws:
com.sas.table.TableException

setSize

public void setSize(int rowCount,
                    int colCount)
Sets the size of this table.

If the new row count is greater than the current row count, new empty rows are added to the end of the table. If the new row count is less than the current row count, all rows at indices greater than the new row count are discarded.

If the new column count is greater than the current column count, new columns of type String are added to the end of the table. If the new column count is less than the current column count, all columns at indices greater than the new column count are discarded.

All created rows and columns are assigned default labels derived from their index. For example, 1,2,3,...etc. for rows and A,B,C,...etc. for columns.

Parameters:
rowCount - The number of rows to assign the table.
colCount - The number of columns to assign the table.

removeWastedSpace

protected void removeWastedSpace()
If there is wasted space in the internal vectors due to removing many rows or columns, reclaim it.


setDefaultValues

public void setDefaultValues()
Override the setDefaultValues method to initialize local variables

Specified by:
setDefaultValues in interface ComponentInterface
Overrides:
setDefaultValues in class Component
See Also:
ComponentInterface.setDefaultValues()

disableEvents

public void disableEvents()
Suspends sending of ContentsChangedEvent, which otherwise would be sent on every update method call, such as setCell or addColumn.

Specified by:
disableEvents in interface com.sas.util.EventGateInterface
See Also:
EventGateInterface.disableEvents()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clone the simple table object

Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class Component
Returns:
a clone of the simple table.
Throws:
java.lang.CloneNotSupportedException - if the clone fails.

equals

public boolean equals(java.lang.Object o)
implementation of Object.equals(Object).

Overrides:
equals in class java.lang.Object
Parameters:
o - an object
Returns:
if o is an instance of SimpleTable, returns equals((SimpleTable) o) else return false

equals

public boolean equals(SimpleTable table)
Compare this SimpleTable to another SimpleTable

Parameters:
table - another SimpleTable object
Returns:
true if the two tables are the same size and all items are equals

enableEvents

public void enableEvents()
Resumes sending of ContentsChangedEvent, which otherwise would be sent on every update method call, such as setCell or addColumn.

Specified by:
enableEvents in interface com.sas.util.EventGateInterface
See Also:
EventGateInterface.enableEvents()

enableEvents

protected void enableEvents(com.sas.collection.ContentsChangedEvent e)
Resumes sending of ContentsChangedEvent, which otherwise would be sent on every update method call, such as setCell or addColumn.

See Also:
EventGateInterface.enableEvents()

countColumns

public int countColumns(int maxColumnCount)
This model does not handle the maxColumnCount argument and will always return getColumnCount()

Specified by:
countColumns in interface StaticTableInterface
Parameters:
maxColumnCount - 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).
Returns:
The number of columns known to be available.
See Also:
StaticTableInterface.countColumns(int), getColumnCount()

countRows

public int countRows(int maxRowCount)
This model does not handle the maxRowCount argument and will always return getRowCount()

Specified by:
countRows in interface StaticTableInterface
Parameters:
maxRowCount - 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).
Returns:
The number of rows known to be available.
See Also:
StaticTableInterface.countRows(int), getRowCount()

getCell

public java.lang.Object getCell(int rowIndex,
                                int columnIndex)
Description copied from interface: StaticTableInterface
Returns the value of a cell. The cell is identified by the given row and column indices.

Specified by:
getCell in interface StaticTableInterface
Parameters:
rowIndex - A one-based index that identifies the cell's row.
columnIndex - A one-based index that identifies the cell's column.
Returns:
The specified cell's value.
See Also:
StaticTableInterface.getCell(int, int)

getCells

public java.lang.Object[][] getCells(int startRowIndex,
                                     int startColumnIndex,
                                     int rowCount,
                                     int columnCount)
Description copied from interface: StaticTableInterface
Returns the values for a block of cells. The block is identified by the intersection of a range of rows with a range of columns. startRowIndex and rowCount define the start and extent of the row range while startColumnIndex and columnCount define the column range. The set of values is returned as a two-dimensional array, new Object[rowCount][colCount], with values[0][0] containing the value of the cell at (startRowIndex, startColumnIndex).

Specified by:
getCells in interface StaticTableInterface
Parameters:
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.
Returns:
The specified cells' values.
See Also:
StaticTableInterface.getCells(int, int, int, int)

getCellClass

public java.lang.Class getCellClass(int rowIndex,
                                    int columnIndex)
Returns the specific class for each individual cell. If the cell is null, null will be returned for the cell class.

Specified by:
getCellClass in interface StaticTableInterface
Parameters:
rowIndex - A one-based index that identifies the cell's row.
columnIndex - A one-based index that identifies the cell's column.
Returns:
The specified cell's class.
See Also:
StaticTableInterface.getCellClass(int, int)

getCellClasses

public java.lang.Class[][] getCellClasses(int startRowIndex,
                                          int startColumnIndex,
                                          int rowCount,
                                          int columnCount)
Description copied from interface: StaticTableInterface
Returns the classes for a block of cells. The block is identified by the intersection of a range of rows with a range of columns. startRowIndex and rowCount define the start and extent of the row range while startColumnIndex and columnCount define the column range. The set of classes is returned as a two-dimensional array, new Class[rowCount][colCount], with clases[0][0] containing the class of the cell at (startRowIndex, startColumnIndex).

Specified by:
getCellClasses in interface StaticTableInterface
Parameters:
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.
Returns:
The specified cells' classes.
See Also:
StaticTableInterface.getCellClasses(int, int, int, int)

getColumn

public java.lang.Object[] getColumn(int columnIndex)
Description copied from interface: StaticTableInterface
Returns the values of all the cells in a column. The column is identified by the given index. The set of values is returned as an array with each element of the array corresponding to a cell in the column.

Specified by:
getColumn in interface StaticTableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
Returns:
The values of the specified column's cells.
See Also:
StaticTableInterface.getColumn(int)

getColumnCount

public int getColumnCount()
Description copied from interface: StaticTableInterface
Returns the number of columns available. If the number of columns is unknown, -1 should be returned. Note that returning -1 requires the implementation to handle countColumns(), getCells(), and getCellClasses() a little differently; see those methods for more details. Also in the unknown case, the caller should not heedlessly use getRow() since the actual number of columns could be very large.

Specified by:
getColumnCount in interface StaticTableInterface
Returns:
The value of the columnCount property.
See Also:
StaticTableInterface.getColumnCount()

setColumnCount

public void setColumnCount(int numColumns)
Set the number of columns

Parameters:
numColumns - the number of columns. If smaller, columns whose index is greater than numColumns are deleted. If larger, empty columns are added
See Also:
setRowCount(int), setSize(int, int)

getRow

public java.lang.Object[] getRow(int rowIndex)
Description copied from interface: StaticTableInterface
Returns the values of all the cells in a row. The row is identified by the given index. The set of values is returned as an array with each element of the array corresponding to a cell in the row.

Specified by:
getRow in interface StaticTableInterface
Parameters:
rowIndex - A one-based index that identifies the row.
Returns:
The values of the specified row's cells.
See Also:
StaticTableInterface.getRow(int)

getRowCount

public int getRowCount()
Description copied from interface: StaticTableInterface
Returns the number of rows available. If the number of rows is unknown, -1 should be returned. Note that returning -1 requires the implementation to handle countRows(), getCells(), and getCellClasses() a little differently; see those methods for more details. Also in the unknown case, the caller should not heedlessly use getColumn() since the actual number of rows could be very large.

Specified by:
getRowCount in interface StaticTableInterface
Returns:
The value of the rowCount property.
See Also:
StaticTableInterface.getRowCount()

setRowCount

public void setRowCount(int numRows)
Set the number of rows

Parameters:
numRows - the number of rows If smaller, rows whose index is greater than numRows are deleted. If larger, empty rows are added
See Also:
setColumnCount(int), setSize(int, int)

isCellsModifiable

public boolean isCellsModifiable()
In this model, the cells are always modifiable, so this method always returns true.

Specified by:
isCellsModifiable in interface TableInterface
Returns:
true if cells can be modified, and false otherwise.
See Also:
TableInterface.isCellsModifiable()

isMultipleRowUpdateSupported

public boolean isMultipleRowUpdateSupported()
In this model, multiple row update is always supported, so this method always returns true.

Specified by:
isMultipleRowUpdateSupported in interface TableInterface
Returns:
true if multiple rows can be simultaneously updated, and false otherwise.
See Also:
TableInterface.isMultipleRowUpdateSupported()

isMultipleColumnUpdateSupported

public boolean isMultipleColumnUpdateSupported()
In this model, multiple column update is always supported, so this method always returns true.

Specified by:
isMultipleColumnUpdateSupported in interface TableInterface
Returns:
true if multiple columns can be simultaneously updated, and false otherwise.
See Also:
TableInterface.isMultipleColumnUpdateSupported()

setCell

public void setCell(int rowIndex,
                    int columnIndex,
                    java.lang.Object data)
Description copied from interface: TableInterface
Specifies the value of a cell. The cell is identified by the given row and column indices.

Specified by:
setCell in interface TableInterface
Parameters:
rowIndex - A one-based index that identifies the cell's row.
columnIndex - A one-based index that identifies the cell's column.
data - The cell's new value.
See Also:
TableInterface.setCell(int, int, java.lang.Object)

setCells

public void setCells(int startRowIndex,
                     int startColumnIndex,
                     int rowCount,
                     int columnCount,
                     java.lang.Object[][] cells)
Description copied from interface: TableInterface
Specifies the values for a block of cells. The block is identified by the intersection of a range of rows with a range of columns. startRowIndex and rowCount define the start and extent of the row range while startColumnIndex and columnCount define the column range. The set of values is specified as a two-dimensional array, new Object[rowCount][colCount], with values[0][0] containing the value of the cell at (startRowIndex, startColumnIndex). Usually, the implementation will require that the class of each new value match what's returned by getCellClass() for the corresponding cell, but a common exception to this will be implementations that allow values to be instances of com.sas.MissingValues.

Specified by:
setCells in interface TableInterface
Parameters:
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.
cells - The new values for each cell in the block.
See Also:
TableInterface.setCells(int, int, int, int, java.lang.Object[][])

setColumn

public void setColumn(int columnIndex,
                      java.lang.Object[] cells)
Description copied from interface: TableInterface
Specifies the values of all the cells in a column. The column is identified by the given index. The set of values is specified as an array with each element of the array corresponding to a cell in the column. Usually, the implementation will require that the class of each new value match what's returned by getCellClass() for the corresponding cell, but a common exception to this will be implementations that allow values to be instances of com.sas.MissingValues.

Specified by:
setColumn in interface TableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
cells - The new values for each cell in the column.
See Also:
TableInterface.setColumn(int, java.lang.Object[])

setRow

public void setRow(int rowIndex,
                   java.lang.Object[] cells)
Description copied from interface: TableInterface
Specifies the values of all the cells in a row. The row is identified by the given index. The set of values is specified as an array with each element of the array corresponding to a cell in the row. Usually, the implementation will require that the class of each new value match what's returned by getCellClass() for the corresponding cell, but a common exception to this will be implementations that allow values to be instances of com.sas.MissingValues.

Specified by:
setRow in interface TableInterface
Parameters:
rowIndex - A one-based index that identifies the row.
cells - The new values for each cell in the row.
See Also:
TableInterface.setRow(int, java.lang.Object[])

isRowLabelsSupported

public boolean isRowLabelsSupported()
Specified by:
isRowLabelsSupported in interface com.sas.table.StaticRowLabelInterface
See Also:
StaticRowLabelInterface.isRowLabelsSupported()

getRowLabel

public java.lang.Object getRowLabel(int rowIndex)
Specified by:
getRowLabel in interface com.sas.table.StaticRowLabelInterface
See Also:
StaticRowLabelInterface.getRowLabel(int)

getRowLabels

public java.lang.Object[] getRowLabels(int startRowIndex,
                                       int rowCount)
Specified by:
getRowLabels in interface com.sas.table.StaticRowLabelInterface
See Also:
StaticRowLabelInterface.getRowLabels(int, int)

isRowsLabelSupported

public boolean isRowsLabelSupported()
Specified by:
isRowsLabelSupported in interface com.sas.table.StaticRowLabelInterface
See Also:
StaticRowLabelInterface.isRowsLabelSupported()

isRowLabelsModifiable

public boolean isRowLabelsModifiable()
Description copied from interface: RowLabelInterface
Indicates whether row labels can be modified. Normally the act of implementing this interface would indicate that labels can be modified, but some implementations may have read-only modes.

Specified by:
isRowLabelsModifiable in interface RowLabelInterface
Returns:
true if row labels can be modified, and false otherwise.
See Also:
RowLabelInterface.isRowLabelsModifiable()

setRowLabel

public void setRowLabel(int rowIndex,
                        java.lang.Object label)
Description copied from interface: RowLabelInterface
Specifies the label to associate with a row. The row is identified by a given index

When isRowsLabelSupported() is true, setRowLabel(0) can be used to set the label for the entire set of row labels.

Specified by:
setRowLabel in interface RowLabelInterface
Parameters:
rowIndex - A one-based index that identifies the row. See note about use of zero above.
label - The row's new label.
See Also:
RowLabelInterface.setRowLabel(int, java.lang.Object)

isColumnLabelsSupported

public boolean isColumnLabelsSupported()
Description copied from interface: StaticColumnLabelInterface
Indicates whether getColumnLabel() and getColumnLabels() should be called. Normally the act of implementing this interface indicates that labels are available, but some implementations may not always have labels available.

Specified by:
isColumnLabelsSupported in interface StaticColumnLabelInterface
Returns:
true if labels are available, and false otherwise.
See Also:
StaticColumnLabelInterface.isColumnLabelsSupported()

getColumnLabel

public java.lang.Object getColumnLabel(int columnIndex)
Description copied from interface: StaticColumnLabelInterface
Returns the label for a column. The column is identified by a given index.

When isColumnsLabelSupported() is true, getColumnLabel(0) can be used to retrieve the label for the entire set of column labels.

Specified by:
getColumnLabel in interface StaticColumnLabelInterface
Parameters:
columnIndex - A one-based index that identifies the column. See note about use of zero above.
Returns:
The specified column's label.
See Also:
StaticColumnLabelInterface.getColumnLabel(int)

getColumnLabels

public java.lang.Object[] getColumnLabels(int startColumnIndex,
                                          int columnCount)
Description copied from interface: StaticColumnLabelInterface
Returns the labels for a range of columns. The range is identified by a given index which defines a starting column and by a given count which defines the extent of the range. The set of labels is returned as an array with each element of the array corresponding to a label in the range.

Specified by:
getColumnLabels in interface StaticColumnLabelInterface
Parameters:
startColumnIndex - A one-based index which identifies the start of the range.
columnCount - The number of labels to return (the extent of the range).
Returns:
The specified columns' labels.
See Also:
StaticColumnLabelInterface.getColumnLabels(int, int)

isColumnsLabelSupported

public boolean isColumnsLabelSupported()
Description copied from interface: StaticColumnLabelInterface
Indicates whether there is support for a column labels label, i.e. a label for the set of column labels taken as a whole. For example, a SAS dataset model might use "VARIABLE". If one is supported, getColumnLabel(0) can be used to access it.

Specified by:
isColumnsLabelSupported in interface StaticColumnLabelInterface
Returns:
true if a column labels label is supported, and false otherwise.
See Also:
StaticColumnLabelInterface.isColumnsLabelSupported()

isColumnLabelsModifiable

public boolean isColumnLabelsModifiable()
Description copied from interface: ColumnLabelInterface
Indicates whether column labels can be modified. Normally the act of implementing this interface would indicate that labels can be modified, but some implementations may have read-only modes.

Specified by:
isColumnLabelsModifiable in interface ColumnLabelInterface
Returns:
true if column labels can be modified, and false otherwise.
See Also:
ColumnLabelInterface.isColumnLabelsModifiable()

setColumnLabel

public void setColumnLabel(int columnIndex,
                           java.lang.Object label)
Description copied from interface: ColumnLabelInterface
Specifies the label to associate with a column. The column is identified by a given index

When isColumnsLabelSupported() is true, setColumnLabel(0) can be used to set the label for the entire set of column labels.

Specified by:
setColumnLabel in interface ColumnLabelInterface
Parameters:
columnIndex - A one-based index that identifies the column. See note about use of zero above.
label - The column's new label.
See Also:
ColumnLabelInterface.setColumnLabel(int, java.lang.Object)

getColumnClasses

public java.lang.Class[] getColumnClasses()
See Also:
StaticRowTemplateTableInterface.getColumnClasses(int, int)

getColumnClass

public java.lang.Class getColumnClass(int columnIndex)
Description copied from interface: StaticRowTemplateTableInterface
Returns the class of a column. The column is identified by the given index. Null will be returned for columns that do not contain cells of a single class.

Specified by:
getColumnClass in interface StaticRowTemplateTableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
Returns:
The specified column's class.
See Also:
StaticRowTemplateTableInterface.getColumnClass(int)

getColumnClasses

public java.lang.Class[] getColumnClasses(int startColumnIndex,
                                          int columnCount)
Description copied from interface: StaticRowTemplateTableInterface
Returns the classes for 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 classes is returned as an array with each element of the array corresponding to a column in the range. The class of columns that do not contain cells of a single class should be expressed as null.

Specified by:
getColumnClasses in interface StaticRowTemplateTableInterface
Parameters:
startColumnIndex - A one-based index which identifies the start of the range.
columnCount - The number of classes to return; defines the extent of the range.
Returns:
The specified columns' classes.
See Also:
StaticRowTemplateTableInterface.getColumnClasses(int, int)

addColumn

public void addColumn(int columnIndex,
                      java.lang.Class type,
                      java.lang.Object defaultValue)
The specified default value will be used to set the value of every cell in the new column.

Specified by:
addColumn in interface RowTemplateTableInterface
Parameters:
columnIndex - 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.
type - The class of the column's cells.
defaultValue - The default value for the column's cells.
See Also:
RowTemplateTableInterface.addColumn(int, java.lang.Class, java.lang.Object)

addColumn

public void addColumn(int columnIndex)
Add a default column at columnIndex The column type will be Object and the default value will be null.


addRow

public void addRow(int rowIndex)
The row will be filled in with the default values for each column.

Specified by:
addRow in interface RowTemplateTableInterface
Parameters:
rowIndex - 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.
See Also:
RowTemplateTableInterface.addRow(int, java.lang.Object[])

addRow

public void addRow(int rowIndex,
                   java.lang.Object[] values)
Description copied from interface: RowTemplateTableInterface
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.

Specified by:
addRow in interface RowTemplateTableInterface
Parameters:
rowIndex - 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:
java.lang.IllegalArgumentException - Thrown if values.length is not the current number of columns
See Also:
RowTemplateTableInterface.addRow(int, java.lang.Object[])

deleteColumn

public void deleteColumn(int columnIndex)
Deleting the column will delete any associated column labels as well.

Specified by:
deleteColumn in interface RowTemplateTableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
See Also:
RowTemplateTableInterface.deleteColumn(int)

deleteRow

public void deleteRow(int rowIndex)
Deleting the row will delete any associated row labels as well.

Specified by:
deleteRow in interface RowTemplateTableInterface
Parameters:
rowIndex - A one-based index that identifies the row.
See Also:
RowTemplateTableInterface.deleteRow(int)

getColumnDefaultValue

public java.lang.Object getColumnDefaultValue(int columnIndex)
Description copied from interface: RowTemplateTableInterface
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.

Specified by:
getColumnDefaultValue in interface RowTemplateTableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
Returns:
The column's default value.
See Also:
RowTemplateTableInterface.getColumnDefaultValue(int)

getColumnDefaultValues

public java.lang.Object[] getColumnDefaultValues(int startColumnIndex,
                                                 int columnCount)
Description copied from interface: RowTemplateTableInterface
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.

Specified by:
getColumnDefaultValues in interface RowTemplateTableInterface
Parameters:
startColumnIndex - A one-based index which identifies the start of the range.
columnCount - The number of default values to return; defines the extent of the range.
Returns:
The specified columns' default values.
See Also:
RowTemplateTableInterface.getColumnDefaultValues(int, int)

isColumnsDeletable

public boolean isColumnsDeletable()
In this model, the columns can always be deleted, so this method will always return true.

Specified by:
isColumnsDeletable in interface RowTemplateTableInterface
Returns:
True if columns can be deleted, false otherwise.
See Also:
RowTemplateTableInterface.isColumnsDeletable()

isColumnsExtendable

public boolean isColumnsExtendable()
In this model, the columns list can always be extended, so this method will always return true.

Specified by:
isColumnsExtendable in interface RowTemplateTableInterface
Returns:
True if new columns can be added, false otherwise.
See Also:
RowTemplateTableInterface.isColumnsExtendable()

isColumnsInsertable

public boolean isColumnsInsertable()
In this model, new columns can always be inserted, so this method will always return true.

Specified by:
isColumnsInsertable in interface RowTemplateTableInterface
Returns:
True if new columns can be inserted, false otherwise.
See Also:
RowTemplateTableInterface.isColumnsInsertable()

isColumnsRedefinable

public boolean isColumnsRedefinable()
In this model, column types can always be redefined, so this method will always return true.

Specified by:
isColumnsRedefinable in interface RowTemplateTableInterface
Returns:
True if columns can be redefined, false otherwise.
See Also:
RowTemplateTableInterface.isColumnsRedefinable()

isRowsDeletable

public boolean isRowsDeletable()
In this model, rows can always be deleted, so this method will always return true.

Specified by:
isRowsDeletable in interface RowTemplateTableInterface
Specified by:
isRowsDeletable in interface SortableTableInterface
Returns:
True if rows can be deleted, false otherwise.
See Also:
RowTemplateTableInterface.isRowsDeletable()

isRowsExtendable

public boolean isRowsExtendable()
In this model, the rows list can always be extended, so this method will always return true.

Specified by:
isRowsExtendable in interface RowTemplateTableInterface
Returns:
True if new rows can be added, false otherwise.
See Also:
RowTemplateTableInterface.isRowsExtendable()

isRowsInsertable

public boolean isRowsInsertable()
In this model, new rows can always be inserted, so this method will always return true.

Specified by:
isRowsInsertable in interface RowTemplateTableInterface
Returns:
True if new rows can be inserted, false otherwise.
See Also:
RowTemplateTableInterface.isRowsInsertable()

setColumnDefaultValue

public void setColumnDefaultValue(int columnIndex,
                                  java.lang.Object newValue)
The default column values apply only to subsequent calls to addRow or addColumn, and not to cell values that are already set. Therefore, for the column default values to be used, it should be called before addRow and addColumn.

Specified by:
setColumnDefaultValue in interface RowTemplateTableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
newValue - The new defaultValue to associate with the column.
See Also:
RowTemplateTableInterface.setColumnDefaultValue(int, java.lang.Object)

setColumnClass

public void setColumnClass(int columnIndex,
                           java.lang.Class newValue)
The column class is returned in the getColumnClass method. This column class is not enforced on any sets or adds of cell values.

Specified by:
setColumnClass in interface RowTemplateTableInterface
Parameters:
columnIndex - A one-based index that identifies the column.
See Also:
RowTemplateTableInterface.setColumnClass(int, java.lang.Class)

setColumnLabelsSupported

public void setColumnLabelsSupported(boolean columnLabelsSupported)

setRowLabelsSupported

public void setRowLabelsSupported(boolean rowLabelsSupported)

deleteAllColumns

public void deleteAllColumns()
deleteAllColumns is a convenience method which deletes all the column definitions in the table. It is the equivalent of calling deleteColumn for every column. To delete the rows call deleteAllRows.

See Also:
deleteColumn(int), deleteAllRows()

deleteAllRows

public void deleteAllRows()
deleteAllRows is a convenience method which deletes all the rows in the table. It is the equivalent of calling deleteRow for every row. To delete the column definitions, call deleteAllColumns.

See Also:
deleteRow(int), deleteAllColumns()

addContentsChangedListener

public void addContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Add a listener for the com.sas.util.ContentsChangedEvent event.

Specified by:
addContentsChangedListener in interface com.sas.collection.ContentsChangedSource
Parameters:
listener - an object which handles ContentsChangedEvent events the listener is not added a second time if it already exists in the list of listeners for this event. If listener is null, it is ignored.
See Also:
ContentsChangedSource

removeContentsChangedListener

public void removeContentsChangedListener(com.sas.collection.ContentsChangedListener listener)
Remove a listener for the com.sas.util.ContentsChangedEvent event. Nothing happens if the listener is not in the list of listeners for this event.

Specified by:
removeContentsChangedListener in interface com.sas.collection.ContentsChangedSource
Parameters:
listener - an object which handles ContentsChangedEvent events
See Also:
ContentsChangedSource

fireContentsChanged

protected void fireContentsChanged(com.sas.collection.ContentsChangedEvent event)
Send a ContentsChangedEvent event to all the ContentsChangedListener objects in the listener list. The listener list is copied first, so the event is sent only to each item which is in the list at the time of this copy, even if adds or removes are performed after the send has started. Also sends the ContentsChangedEvent, which extends PropertyChangeEvent, to all registered propertyChangeListeners, if there ar any.

Parameters:
event - the event to send

fireContentsChanged

protected void fireContentsChanged()
Fire a default contents changed event. A ContentsChangedEvent will be constructed with this as the source and fireContentsChanged will be called.

See Also:
fireContentsChanged(com.sas.collection.ContentsChangedEvent)

anyContentsChangedListeners

protected boolean anyContentsChangedListeners()
Test is there is any registered event listener for a ContentsChangedEvent, or any registered PropertyChangeEvent.

Returns:
true if there is one or more listeners for either a ContentsChangedEvent or a PropertyChangeEvent. Returns false if events are disabled.
See Also:
disableEvents(), enableEvents()

getDefaultCellStyle

public StaticPropertyBagInterface getDefaultCellStyle()
Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for cells. There are no style properties by default.

Specified by:
getDefaultCellStyle in interface StaticTableStyleInterface
Returns:
The value of the defaultCellStyle property.
See Also:
setDefaultCellStyle(com.sas.collection.StaticPropertyBagInterface)

setDefaultCellStyle

public void setDefaultCellStyle(StaticPropertyBagInterface newValue)
Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for cells. There are no style properties by default.

Parameters:
newValue - The new value to assign the defaultCellStyle property; may be null.
See Also:
getDefaultCellStyle()

getDefaultColumnStyle

public StaticPropertyBagInterface getDefaultColumnStyle()
Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for columns. There are no style properties by default.

Specified by:
getDefaultColumnStyle in interface StaticTableStyleInterface
Returns:
The value of the defaultColumnStyle property.
See Also:
setDefaultColumnStyle(com.sas.collection.StaticPropertyBagInterface)

setDefaultColumnStyle

public void setDefaultColumnStyle(StaticPropertyBagInterface newValue)
Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for columns. There are no style properties by default.

Parameters:
newValue - The new value to assign the defaultColumnStyle property; may be null.
See Also:
getDefaultColumnStyle()

getDefaultLabelStyle

public StaticPropertyBagInterface getDefaultLabelStyle()
Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for labels. There are no style properties by default.

Specified by:
getDefaultLabelStyle in interface StaticTableStyleInterface
Returns:
The value of the defaultLabelStyle property.
See Also:
setDefaultLabelStyle(com.sas.collection.StaticPropertyBagInterface)

setDefaultLabelStyle

public void setDefaultLabelStyle(StaticPropertyBagInterface newValue)
Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for labels. There are no style properties by default.

Parameters:
newValue - The new value to assign the defaultLabelStyle property; may be null.
See Also:
getDefaultLabelStyle()

getDefaultRowStyle

public StaticPropertyBagInterface getDefaultRowStyle()
Returns the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for rows. There are no style properties by default.

Specified by:
getDefaultRowStyle in interface StaticTableStyleInterface
Returns:
The value of the defaultRowStyle property.
See Also:
setDefaultRowStyle(com.sas.collection.StaticPropertyBagInterface)

setDefaultRowStyle

public void setDefaultRowStyle(StaticPropertyBagInterface newValue)
Specifies the set of style property keys and their associated values that serve as formatting and rendering defaults and hints for rows. There are no style properties by default.

Parameters:
newValue - The new value to assign the defaultRowStyle property; may be null.
See Also:
getDefaultRowStyle()

getCellStyle

public StaticPropertyBagInterface getCellStyle(int rowIndex,
                                               int colIndex)
Throws an exception since SimpleTable does not support styles on a per-cell basis at this time.

Specified by:
getCellStyle in interface StaticTableStyleInterface
Parameters:
rowIndex - One-based index that identifies the cell's row.
colIndex - One-based index that identifies the cell's column.
Returns:
The set of style property keys and their associated values that serve as formatting and rendering defaults and hints for the cell.
See Also:
isCellStylesSupported()

isCellStylesSupported

public boolean isCellStylesSupported()
Returns false since SimpleTable does not support styles a per-cell basis at this time.

Specified by:
isCellStylesSupported in interface StaticTableStyleInterface
Returns:
true if styles are supported on a per-cell basis and false otherwise.
See Also:
getCellStyle(int, int)

getColumnLabelStyle

public StaticPropertyBagInterface getColumnLabelStyle(int colIndex)
Throws an exception since SimpleTable does not support styles on a per-column-label basis at this time.

Specified by:
getColumnLabelStyle in interface StaticTableStyleInterface
Parameters:
colIndex - One-based index that identifies the label's column.
Returns:
The set of style property keys and their associated values that serve as formatting and rendering defaults and hints for the label.
See Also:
isColumnLabelStylesSupported()

isColumnLabelStylesSupported

public boolean isColumnLabelStylesSupported()
Returns false since SimpleTable does not support styles a per-column-label basis at this time.

Specified by:
isColumnLabelStylesSupported in interface StaticTableStyleInterface
Returns:
true if styles are supported on a per-column-label basis and false otherwise.
See Also:
getColumnLabelStyle(int)

getColumnStyle

public StaticPropertyBagInterface getColumnStyle(int colIndex)
Throws an exception since SimpleTable does not support styles on a per-column basis at this time.

Specified by:
getColumnStyle in interface StaticTableStyleInterface
Parameters:
colIndex - One-based index that identifies the column.
Returns:
The set of style property keys and their associated values that serve as formatting and rendering defaults and hints for the column.
See Also:
isColumnStylesSupported()

isColumnStylesSupported

public boolean isColumnStylesSupported()
Returns false since SimpleTable does not support styles a per-column basis at this time.

Specified by:
isColumnStylesSupported in interface StaticTableStyleInterface
Returns:
true if styles are supported on a per-column basis and false otherwise.
See Also:
getColumnStyle(int)

getRowLabelStyle

public StaticPropertyBagInterface getRowLabelStyle(int rowIndex)
Throws an exception since SimpleTable does not support styles on a per-row-label basis at this time.

Specified by:
getRowLabelStyle in interface StaticTableStyleInterface
Parameters:
rowIndex - One-based index that identifies the label's row.
Returns:
The set of style property keys and their associated values that serve as formatting and rendering defaults and hints for the label.
See Also:
isRowLabelStylesSupported()

isRowLabelStylesSupported

public boolean isRowLabelStylesSupported()
Returns false since SimpleTable does not support styles a per-row-label basis at this time.

Specified by:
isRowLabelStylesSupported in interface StaticTableStyleInterface
Returns:
true if styles are supported on a per-row-label basis and false otherwise.
See Also:
getRowLabelStyle(int)

getRowStyle

public StaticPropertyBagInterface getRowStyle(int rowIndex)
Throws an exception since SimpleTable does not support styles on a per-row basis at this time.

Specified by:
getRowStyle in interface StaticTableStyleInterface
Parameters:
rowIndex - One-based index that identifies the row.
Returns:
The set of style property keys and their associated values that serve as formatting and rendering defaults and hints for the row.
See Also:
isRowStylesSupported()

isRowStylesSupported

public boolean isRowStylesSupported()
Returns false since SimpleTable does not support styles a per-row basis at this time.

Specified by:
isRowStylesSupported in interface StaticTableStyleInterface
Returns:
true if styles are supported on a per-row basis and false otherwise.
See Also:
getRowStyle(int)

sort

public final void sort(java.util.Comparator comparator,
                       boolean removeDuplicates)
                throws com.sas.table.TableException
Sort the table in place, based on comparing row contents using the comparator. This method is an alias for
 sort(comparator, 1, -1, null);
 
followed by a call to
 removeDuplicates(comparator, 1, -1, true, null);
 
if removeDuplicates is true

Throws:
com.sas.table.TableException

newRowComparator

protected java.util.Comparator newRowComparator()

sort

public void sort(java.util.Comparator comparator,
                 int startRowIndex,
                 int endRowIndex,
                 int[] permutation)
          throws com.sas.table.TableException
Sort the table in place, based on comparing row contents using the comparator. See SortableTableInterface.sort(Comparator, int, int, int[]).

Specified by:
sort in interface SortableTableInterface
Parameters:
comparator - the Comparator to use to compare table rows. Row values are passed to the comparator an Object[] array or a List. Use getCell(Object row, int columnIndex) to extract a cell from this row for use in the comparator. If comparator is null, a Comparator is made from combining all column comparators.
startRowIndex - the index of the first row of the range of rows to sort.
endRowIndex - one greater than then index of the last row of the range of rows to sort, or -1 to include all rows through the end of the table. See also startRowIndex and endRowIndex above.
permutation - the permutation under which the table was sorted. This may be null; otherwise it must be initialized with the consecutive integers from 0 to table.getRowCount() - 1 (the permutation is 0 based). If non-null, the sort method will return the sort permutation in this int[] array. See Permuter.identityPermutation(int)
Throws:
com.sas.table.TableException - if the table operation cannot be performed

normalizeStartRow

public int normalizeStartRow(int rowNumber)

normalizeEndRow

public int normalizeEndRow(int rowNumber)

sort

public final void sort(int columnIndex,
                       java.util.Comparator comparator,
                       boolean removeDuplicates)
                throws com.sas.table.TableException
Sort the table in place, based on comparing elements from the column columnIndex, using the comparator. This method is an alias for
 sort(columnIndex, comparator, 1, -1, nul);
 
followed by a call to
 removeDuplicates(columnIndex, comparator, 1, -1, true, null);
 
if removeDuplicates is true

Throws:
com.sas.table.TableException

sort

public void sort(int columnIndex,
                 java.util.Comparator comparator,
                 int startRowIndex,
                 int endRowIndex,
                 int[] permutation)
          throws com.sas.table.TableException
Sort the table in place, based on comparing elements from the column columnIndex, using the comparator. See SortableTableInterface.sort(int, Comparator, int, int, int[]).

Specified by:
sort in interface SortableTableInterface
Parameters:
columnIndex - the column index to use for sorting. Table column indices are 1-based.
comparator - the comparator to use to compare table cells When sorting by a column, only table cell values table.getCell(a, columnIndex) and table.getCell(b, columnIndex) are passed to the comparator. If this value is null, use the comparator assigned to this row with SortableTableInterface.setColumnComparator(int, Comparator)
startRowIndex - the index of the first row of the range of rows to sort.
endRowIndex - one greater than then index of the last row of the range of rows to sort, or -1 to include all rows through the end of the table. See also startRowIndex and endRowIndex above.
permutation - the permutation under which the table was sorted. This may be null; otherwise it must be initialized with the consecutive integers from 0 to table.getRowCount() - 1 (the permutation is 0 based). If non-null, the sort method will return the sort permutation in this int[] array. See Permuter.identityPermutation(int)
Throws:
com.sas.table.TableException - if the table operation cannot be performed

sort

public final void sort(int[] columnIndices,
                       java.util.Comparator[] comparators,
                       boolean removeDuplicates)
                throws com.sas.table.TableException
Sort the table in place, based on comparing elements from multiple columns listed in columnIndices, using the corresponding Comparator from the array, comparators. This method is an alias for
 sort(columnIndices,comparator, 1, -1, null);
 
followed by a call to
 removeDuplicates(columnIndices,comparators, 1, -1, true, null);
 
if removeDuplicates is true

Throws:
com.sas.table.TableException

sort

public void sort(int[] columnIndices,
                 java.util.Comparator[] comparators,
                 int startRowIndex,
                 int endRowIndex,
                 int[] permutation)
          throws com.sas.table.TableException
Sort the table in place, based on comparing elements from multiple columns listed in columnIndices, using the corresponding Comparator from the array, comparators. See SortableTableInterface.sort(int[], Comparator[], int, int, int[]).

Specified by:
sort in interface SortableTableInterface
Parameters:
columnIndices - an array of column indices to use for sorting. Table column indices are 1-based.
comparators - the comparators to use to compare table cells comparators.length must not be less than columnIndices.length. If any comparators[col] is null, for a column col use getColumnComparator(col)
startRowIndex - the index of the first row of the range of rows to sort.
endRowIndex - one greater than then index of the last row of the range of rows to sort, or -1 to include all rows through the end of the table. See also startRowIndex and endRowIndex above.
permutation - the permutation under which the table was sorted. This may be null; otherwise it must be initialized with the consecutive integers from 0 to table.getRowCount() - 1 (the permutation is 0 based). If non-null, the sort method will return the sort permutation in this int[] array See Permuter.identityPermutation(int)
Throws:
com.sas.table.TableException - if the table operation cannot be performed

newColumnComparator

protected java.util.Comparator newColumnComparator(int col,
                                                   java.util.Comparator comparator)
Returns the column comparator for the column col or if it is null, return ConstantComparator.COMPARE_EQUALS


newCompositeComparator

public java.util.Comparator newCompositeComparator(int[] columnIndices,
                                                   java.util.Comparator[] comparators)
Return a CompositeComparator that compares using the comparators or, if any element of comparators column comparators is null, the corresponding column comparator. For example, to construct a row comparator for sorting the table via sort(Comparator, boolean) or sort(Comparator, int, int, int[]), such that column 4 is the primary key and column 2 as secondary key, use newCompositeComparator(new int[] { 4, 2 }, null);

Parameters:
columnIndices - an array of column numbers for which you want to create a composite comparator The comparator for column columnIndices[0] serves as the primary comparison key; the comparator for column columnIndices[1] serves as the secondary comparison key, and so on. If an element is 0, that element all all remaining columnIndices and comparators are ignored.
comparators - an array of comparators, corresponding to the elements in columnIndices. This array may be null, or elements may be null, in which case the corresponding column comparator, getColumnComparator(columnIndices[i]) will be used.

permute

public void permute(int[] permutation)
             throws com.sas.table.TableException
Permute a table according to a permutation array. See SortableTableInterface.permute(int[]).

Specified by:
permute in interface SortableTableInterface
Parameters:
permutation - An array indicating how to permute the rows. For example, with a table of five rows, the permutation { 3, 1, 0, 4, 2 } will reorder the table as { row4, row2, row1, row5, row3 }. The permutation must contain exactly table.getRowCount() items ranging from 0 to table.getRowCount()-1 with no duplicate values. Note that permutations are 0 based while row numbers are one based.
Throws:
com.sas.table.TableException - if the table operation cannot be performed

removeDuplicates

public final void removeDuplicates(java.util.Comparator comparator)
                            throws com.sas.table.TableException
Remove duplicates from a sorted table, based on comparing the row contents. This method is an alias for
 removeDuplicates(comparator, 1, -1, true, null);
 

Throws:
com.sas.table.TableException

removeDuplicates

public void removeDuplicates(java.util.Comparator comparator,
                             int startRowIndex,
                             int endRowIndex,
                             boolean keepFirst,
                             boolean[] removed)
                      throws com.sas.table.TableException
Remove duplicates from a sorted table, based on comparing the row contents. See SortableTableInterface.removeDuplicates(Comparator, int, int, boolean, boolean[]).

Specified by:
removeDuplicates in interface SortableTableInterface
Parameters:
comparator - a Comparator which compares entire rows. The values passed to this method are Object[] arrays or List objects. Use getCell(Object row, int columnIndex) to extract a cell from this row for use in the comparator. If comparator is null, a Comparator is made from combining all column comparators.
startRowIndex - the index of the first row of the range of rows to search for duplicates.
endRowIndex - one greater than then index of the last row of the range of rows to search for duplicates, or -1 to include all rows through the end of the table. See also startRowIndex and endRowIndex above.
keepFirst - if true, then when comparing rows i and i+1, row i+1 is removed when equal. If false, row i is removed when equal.
removed - Flags indicating which items were removed. If row i was removed, then removed[i-1] is set to true, else false. This parameter may be null if you do not need to record the removed rows. Otherwise, it must contain table.getRowCount() elements. This array is zero based, whereas row numbers are one based. This method does not change elements of removed outside of the range of rows specified by endRowIndex and endRowIndex.
Throws:
com.sas.table.TableException - if the table operation cannot be performed

removeDuplicates

public final void removeDuplicates(int columnIndex,
                                   java.util.Comparator comparator)
                            throws com.sas.table.TableException
Remove duplicates from a sorted table, based on comparing cell contents from a single column. This method is an alias for
 removeDuplicates(comparator, 1, -1, true, null);

Throws:
com.sas.table.TableException

removeDuplicates

public void removeDuplicates(int columnIndex,
                             java.util.Comparator comparator,
                             int startRowIndex,
                             int endRowIndex,
                             boolean keepFirst,
                             boolean[] removed)
                      throws com.sas.table.TableException
Remove duplicates from a sorted table, based on comparing cell contents from a single column. See SortableTableInterface.removeDuplicates(int, Comparator, int, int, boolean, boolean[]).

Specified by:
removeDuplicates in interface SortableTableInterface
comparator - a Comparator which compares table cells. If null, use getColumnComparator(columnIndex).
startRowIndex - the index of the first row of the range of rows to search for duplicates.
endRowIndex - one greater than then index of the last row of the range of rows to search for duplicates, or -1 to include all rows through the end of the table. See also startRowIndex and endRowIndex above.
keepFirst - if true, then when comparing rows i and i+1, row i+1 is removed when equal. If false, row i is removed when equal.
removed - Flags indicating which items were removed. See the same parameter in SortableTableInterface.removeDuplicates(Comparator,int,int,boolean,boolean[])
Throws:
com.sas.table.TableException - if the table operation cannot be performed

removeDuplicates

public final void removeDuplicates(int[] columnIndices,
                                   java.util.Comparator[] comparators)
                            throws com.sas.table.TableException
Remove duplicates from a sorted table, based on comparing cell contents from multiple columns. This method is an alias for
 removeDuplicates(comparator, 1, -1, true, null);

Throws:
com.sas.table.TableException

removeDuplicates

public void removeDuplicates(int[] columnIndices,
                             java.util.Comparator[] comparators,
                             int startRowIndex,
                             int endRowIndex,
                             boolean keepFirst,
                             boolean[] removed)
                      throws com.sas.table.TableException
Remove duplicates from a sorted table, based on comparing cell contents from multiple columns. See SortableTableInterface.removeDuplicates(int[], Comparator[], int, int, boolean, boolean[]).

Specified by:
removeDuplicates in interface SortableTableInterface
startRowIndex - the index of the first row of the range of rows to search for duplicates. Normally, this is 1
endRowIndex - one greater than then index of the last row of the range of rows to search for duplicates, or -1 to include all rows through the end of the table, See also startRowIndex and endRowIndex above.
keepFirst - if true, then when comparing rows i and i+1, row i+1 is removed when equal. If false, row i is removed when equal.
removed - Flags indicating which items were removed. See the same parameter in SortableTableInterface.removeDuplicates(Comparator,int,int,boolean,boolean[])
Throws:
com.sas.table.TableException - if the table operation cannot be performed

deleteRows

public void deleteRows(boolean[] delete)
Delete rows between startRowIndex and endRowIndex as indicated in a vector of flags.

Specified by:
deleteRows in interface SortableTableInterface
Parameters:
delete - If delete[i] is set to true, remove row i+1. The delete array must contain table.getRowCount() elements. This array is zero based, whereas row numbers are one based. The delete row may be obtained from one of the removeDuplicates methods listed in this interface. For example, if you wish to keep two or more tables in sync and you remove duplicate rows from table A, you can have the removeDuplicates method record the deleted rows and then use deleteRows to remove the same rows from tables B and C.

getColumnComparator

public java.util.Comparator getColumnComparator(int columnIndex)
Return the comparator associated with this column.

Specified by:
getColumnComparator in interface SortableTableInterface
Parameters:
columnIndex - the column number of the desired comparator. column numbers are one based.

setColumnComparator

public void setColumnComparator(int columnIndex,
                                java.util.Comparator comparator)
Specified by:
setColumnComparator in interface SortableTableInterface

reverseColumnComparator

public void reverseColumnComparator(int columnIndex)
Reverse the sense of the comparator for column columnIndex. This method is useful for changing the default sort order for a column. You must still invoke the correct sort method to sort the table. If the comparator there is a ReverseComparator, replace it with the root comparator, ReverseComparator.getComparator(), else, replace the comparator with new ReverseComparator(getColumnComparator(columnIndex))

Specified by:
reverseColumnComparator in interface SortableTableInterface
Parameters:
columnIndex - the column number whose comparison function you wish to reverse.

getCell

public static java.lang.Object getCell(java.lang.Object row,
                                       int columnIndex)
Extracts the desired cell from a table row using This static method should be used for row based comparators (for either sorting or removing duplicates). It isolates the comparator from row representation details, such as a row being stored as a Object[] array or as a List (such as a Vector or ArrayList).

Parameters:
row - a row value from a table. This may be either an array (an Object[]) or a List
columnIndex - the index of the desired column. This index is 1 based.
Returns:
the indexed cell from the row.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.