public class ExpressionColumn extends AbstractColumn
Column instance that stores values provided by an Expression instance. These expressions can reference other column values within the same table. Values are evaluated when first requested and then cached to increase performance. This column maintains listeners for all referenced columns discovered in the expression and for the expression itself, invalidating all cached entries when an update to either occurs.
WARNING: Infinite recursion, eventually resulting in a StackOverflowError, could occur if an expression refers to its own column, or if two ExpressionColumns have expressions referring to each other. The responsibility for avoiding such situations is left with client programmers. Note that it is fine for one ExpressionColumn to reference another; however, the graph induced by such references must not contain any cycles.
prefuse.data.expressionm_columnType, m_defaultValue, m_listeners, m_parser, m_readOnly| Constructor and Description |
|---|
ExpressionColumn(Table table,
Expression expr)
Create a new ExpressionColumn.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canSet(java.lang.Class type)
Indicates if the set method can be called without
an exception being thrown for the given type.
|
java.lang.Object |
get(int row)
Get the data value at the specified row
|
boolean |
getBoolean(int row)
Get the data value at the specified row as a boolean
|
double |
getDouble(int row)
Get the data value at the specified row as a double
|
float |
getFloat(int row)
Get the data value at the specified row as a float
|
int |
getInt(int row)
Get the data value at the specified row as an integer
|
long |
getLong(int row)
Get the data value at the specified row as a long
|
int |
getRowCount()
Returns the number of rows in this data column
|
protected void |
init() |
void |
invalidateCache(int start,
int end)
Invalidate a range of the cache.
|
boolean |
isCacheValid(int row)
Check if this ExpressionColumn has a valid cached value at the given
row.
|
void |
revertToDefault(int row)
Has no effect, as all values in this column are derived.
|
void |
set(java.lang.Object val,
int row)
Set the data value at the specified row
|
void |
setMaximumRow(int nRows)
Sets the number of rows in this data column
|
addColumnListener, canGet, canGetBoolean, canGetDate, canGetDouble, canGetFloat, canGetInt, canGetLong, canGetString, canSetBoolean, canSetDate, canSetDouble, canSetFloat, canSetInt, canSetLong, canSetString, fireColumnEvent, fireColumnEvent, fireColumnEvent, fireColumnEvent, fireColumnEvent, fireColumnEvent, fireColumnEvent, getColumnType, getDate, getDefaultValue, getParser, getString, isCellEditable, isReadOnly, removeColumnListener, setBoolean, setDate, setDefaultValue, setDouble, setFloat, setInt, setLong, setParser, setReadOnly, setStringpublic ExpressionColumn(Table table, Expression expr)
table - the table this column is a member ofexpr - the expression used to provide the column valuesprotected void init()
public int getRowCount()
ColumnColumn.getRowCount()public void setMaximumRow(int nRows)
ColumnnRows - the number of rowsColumn.setMaximumRow(int)public boolean isCacheValid(int row)
row - the row to check for a valid cache entrypublic void invalidateCache(int start,
int end)
start - the start of the range to invalidateend - the end of the range to invalidate, inclusivepublic void revertToDefault(int row)
revertToDefault in interface ColumnrevertToDefault in class AbstractColumnrow - the row to revertpublic boolean canSet(java.lang.Class type)
AbstractColumncanSet in interface ColumncanSet in class AbstractColumntype - the Class of the data type to checkAbstractColumn.canSet(java.lang.Class)public java.lang.Object get(int row)
Columnrow - the row from which to retrieve the valueColumn.get(int)public void set(java.lang.Object val,
int row)
throws DataTypeException
Columnval - the value to setrow - the row at which to set the valueDataTypeExceptionColumn.set(java.lang.Object, int)public boolean getBoolean(int row)
throws DataTypeException
AbstractColumngetBoolean in interface ColumngetBoolean in class AbstractColumnrow - the row from which to retrieve the valueDataTypeException - if this column does not
support the boolean typeColumn.getBoolean(int)public int getInt(int row)
throws DataTypeException
AbstractColumngetInt in interface ColumngetInt in class AbstractColumnrow - the row from which to retrieve the valueDataTypeException - if this column does not
support the integer typeColumn.getInt(int)public double getDouble(int row)
throws DataTypeException
AbstractColumngetDouble in interface ColumngetDouble in class AbstractColumnrow - the row from which to retrieve the valueDataTypeException - if this column does not
support the double typeColumn.getDouble(int)public float getFloat(int row)
throws DataTypeException
AbstractColumngetFloat in interface ColumngetFloat in class AbstractColumnrow - the row from which to retrieve the valueDataTypeException - if this column does not
support the float typeColumn.getFloat(int)public long getLong(int row)
throws DataTypeException
AbstractColumngetLong in interface ColumngetLong in class AbstractColumnrow - the row from which to retrieve the valueDataTypeException - if this column does not
support the long typeColumn.getLong(int)