public class CascadedTable extends Table
Table subclass featuring a "cascaded" table design - a CascadedTable can have a parent table, from which it inherits a potentially filtered set of rows and columns. Child tables may override the columns of the parent by having a column of the same name as that of the parent, in which case the parent's column will not be accessible.
Table rows of the parent table can be selectively included by providing
a Predicate
that filters the parent rows.
Columns of the parent table can be selectively included by providing
a ColumnProjection
indicating the columns to
include.
Tuple instances backed by a CascadedTable will be not be equivalent to the tuples backed by the parent table. However, setting a value in a CascadedTable that is inherited from a parent table will update the value in the parent table.
Table.ColumnEntry
Modifier and Type | Field and Description |
---|---|
protected ColumnProjection |
m_colFilter
ColumnProjection determining which columns of the parent table
are included in this table.
|
protected prefuse.data.CascadedTable.Listener |
m_listener
An internal listener class
|
protected Table |
m_parent
Cascaded parent table
|
protected java.util.ArrayList |
m_pnames
List of included parent column names
|
protected Predicate |
m_rowFilter
Selection Predicate determining which rows of the parent table
are included in this table.
|
m_columns, m_entries, m_lastCol, m_listeners, m_modCount, m_names, m_rows, m_schema, m_tuples
EMPTY_ARRAY
Modifier | Constructor and Description |
---|---|
protected |
CascadedTable()
Create a CascadedTable without a backing parent table.
|
protected |
CascadedTable(java.lang.Class tupleType)
Create a CascadedTable without a backing parent table.
|
|
CascadedTable(Table parent)
Create a new CascadedTable.
|
|
CascadedTable(Table parent,
ColumnProjection colFilter)
Create a new CascadedTable.
|
|
CascadedTable(Table parent,
Predicate rowFilter)
Create a new CascadedTable.
|
|
CascadedTable(Table parent,
Predicate rowFilter,
ColumnProjection colFilter)
Create a new CascadedTable.
|
protected |
CascadedTable(Table parent,
Predicate rowFilter,
ColumnProjection colFilter,
java.lang.Class tupleType)
Create a new CascadedTable.
|
Modifier and Type | Method and Description |
---|---|
protected int |
addCascadedRow(int prow)
Internal method for adding a new cascaded row backed by
the given parent row.
|
int |
addRow()
Add a row to this table.
|
void |
addRows(int nrows)
Add a given number of rows to this table.
|
protected void |
filterColumns()
Determines which columns are inherited from the backing parent table.
|
void |
filterRows()
Manually trigger a re-filtering of the rows of this table.
|
int |
getChildRow(int prow)
Given a row in the parent table, return the corresponding row, if any,
in this table.
|
Column |
getColumn(int col)
Get the column at the given column number.
|
int |
getColumnCount()
Get the number of columns / data fields in this table.
|
java.lang.String |
getColumnName(int col)
Get the data field name of the column at the given column number.
|
protected java.util.Iterator |
getColumnNames()
Internal method that returns an iterator over column names
|
int |
getColumnNumber(Column col)
Get the column number for the given Column instance.
|
ColumnProjection |
getColumnProjection()
Get the ColumnProjection determining which columns of the
parent table are included in this one.
|
int |
getLocalColumnCount()
Get the number of columns explicitly stored by this table (i.e., all
columns that are not inherited from the parent table).
|
int |
getParentRow(int row)
Given a row in this table, return the corresponding row in the parent
table.
|
Table |
getParentTable()
Get the parent table from which this cascaded table inherits values.
|
Predicate |
getRowFilter()
Gets ths Predicate determining which rows of the parent
table are included in this one.
|
protected boolean |
hasColumn(java.lang.String name)
Internal method indicating if the given data field is included as a
data column.
|
protected void |
invalidateSchema()
Invalidates this table's cached schema.
|
protected boolean |
removeCascadedRow(int row)
Internal method for removing a cascaded row from this table.
|
boolean |
removeRow(int row)
Removes a row from this table.
|
void |
setColumnProjection(ColumnProjection colFilter)
Sets the ColumnProjection determining which columns of the
parent table are included in this one.
|
void |
setRowFilter(Predicate rowFilter)
Sets the Predicate determining which rows of the parent
table are included in this one.
|
addColumn, addColumn, addColumn, addColumn, addColumn, addConstantColumn, addTableListener, addTuple, canGet, canGetBoolean, canGetDate, canGetDouble, canGetFloat, canGetInt, canGetLong, canGetString, canSet, canSetBoolean, canSetDate, canSetDouble, canSetFloat, canSetInt, canSetLong, canSetString, clear, columnChanged, columnChanged, columnChanged, columnChanged, columnChanged, columnChanged, columnChanged, containsTuple, fireTableEvent, get, get, getBoolean, getBoolean, getColumn, getColumnNumber, getColumnRow, getColumns, getColumnType, getColumnType, getDate, getDate, getDefault, getDouble, getDouble, getFloat, getFloat, getIndex, getIndex, getInt, getInt, getLong, getLong, getMaximumRow, getMetadata, getMinimumRow, getModificationCount, getRowCount, getSchema, getString, getString, getTableRow, getTuple, getTupleCount, handleColumnChanged, index, isAddColumnSupported, isCellEditable, isValidRow, iterator, iterator, rangeSortedBy, rangeSortedBy, rangeSortedBy, rangeSortedBy, rangeSortedBy, remove, removeAllTableListeners, removeColumn, removeColumn, removeColumn, removeIndex, removeTableListener, removeTuple, renumberColumns, revertToDefault, rows, rows, rows, rowsSortedBy, select, set, set, setBoolean, setBoolean, setDate, setDate, setDouble, setDouble, setFloat, setFloat, setInt, setInt, setLong, setLong, setString, setString, setTuple, setTupleManager, toString, tuples, tuples, tuplesReversed, updateRowCount
addColumns, addPropertyChangeListener, addPropertyChangeListener, addTupleSetListener, fireTupleEvent, fireTupleEvent, fireTupleEvent, getClientProperty, putClientProperty, removePropertyChangeListener, removePropertyChangeListener, removeTupleSetListener, tuples, tuples
protected Table m_parent
protected java.util.ArrayList m_pnames
protected ColumnProjection m_colFilter
protected Predicate m_rowFilter
protected prefuse.data.CascadedTable.Listener m_listener
public CascadedTable(Table parent)
parent
- the parent Table to usepublic CascadedTable(Table parent, Predicate rowFilter)
parent
- the parent Table to userowFilter
- a Predicate determining which rows of the parent
table to include in this one.public CascadedTable(Table parent, ColumnProjection colFilter)
parent
- the parent Table to usecolFilter
- a ColumnProjection determining which columns of the
parent table to include in this one.public CascadedTable(Table parent, Predicate rowFilter, ColumnProjection colFilter)
parent
- the parent Table to userowFilter
- a Predicate determining which rows of the parent
table to include in this one.colFilter
- a ColumnProjection determining which columns of the
parent table to include in this one.protected CascadedTable(Table parent, Predicate rowFilter, ColumnProjection colFilter, java.lang.Class tupleType)
parent
- the parent Table to userowFilter
- a Predicate determining which rows of the parent
table to include in this one.colFilter
- a ColumnProjection determining which columns of the
parent table to include in this one.tupleType
- the class type of the Tuple instances to useprotected CascadedTable()
protected CascadedTable(java.lang.Class tupleType)
tupleType
- the class type of the Tuple instances to useprotected void filterColumns()
public void filterRows()
ValidEdgePredicate
public ColumnProjection getColumnProjection()
public void setColumnProjection(ColumnProjection colFilter)
colFilter
- a ColumnProjection determining which columns of the
parent table to include in this one.public Predicate getRowFilter()
public void setRowFilter(Predicate rowFilter)
rowFilter
- a Predicate determining which rows of the parent
table to include in this one.public int getColumnCount()
Table
getColumnCount
in class Table
Table.getColumnCount()
public int getLocalColumnCount()
public Table getParentTable()
public int getParentRow(int row)
row
- a row in this tablepublic int getChildRow(int prow)
prow
- a row in the parent tablepublic int addRow()
Table
addRow
in class Table
Table.addRow()
public void addRows(int nrows)
Table
addRows
in class Table
nrows
- the number of rows to add.Table.addRows(int)
public boolean removeRow(int row)
Table
removeRow
in class Table
row
- the row to deleteTable.removeRow(int)
protected int addCascadedRow(int prow)
prow
- the parent row to inheritprotected boolean removeCascadedRow(int row)
row
- the row to removepublic java.lang.String getColumnName(int col)
Table
getColumnName
in class Table
col
- the column numberTable.getColumnName(int)
public int getColumnNumber(Column col)
Table
getColumnNumber
in class Table
col
- the Column instance to lookupTable.getColumnNumber(prefuse.data.column.Column)
public Column getColumn(int col)
Table
getColumn
in class Table
col
- the column numberTable.getColumn(int)
protected boolean hasColumn(java.lang.String name)
Table
hasColumn
in class Table
Table.hasColumn(java.lang.String)
protected java.util.Iterator getColumnNames()
Table
getColumnNames
in class Table
Table.getColumnNames()
protected void invalidateSchema()
invalidateSchema
in class Table
Copyright ? 2013 Regents of the University of California