Class SwappableTable<KEY_TYPE,VALUE_TYPE>
java.lang.Object
com.illumon.iris.db.plot.util.tables.SwappableTable<KEY_TYPE,VALUE_TYPE>
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
SwappableTableOneClickAbstract
public abstract class SwappableTable<KEY_TYPE,VALUE_TYPE> extends Object implements Serializable
Holds a handle on a table that may get swapped out for another table.
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSwappableTable.LocalTableUpdateListenerListens for when the table gets swapped out. -
Field Summary
Fields Modifier and Type Field Description protected TableMapHandletableMapHandle -
Constructor Summary
Constructors Constructor Description SwappableTable(TableMapHandle tableMapHandle)Creates a SwappableTable instance with thetableHandle. -
Method Summary
Modifier and Type Method Description abstract voidaddColumn(String column)Adds a column to the underlying table structures.voidaddDataChangeListener(DataChangeListener listener)Adds a listener to the update list.TableaddLocalTableUpdateListener(SwappableTable.LocalTableUpdateListener listener)Adds a listener to the update list.protected voidbeginBatchUpdate()protected abstract TablecomputeRemoteTable()Computes the remote table.protected voidendBatchUpdate()voidfreezeSnapshots()protected abstract StringgetFriendlyName()Get a readable name for use with threads/logs etc.protected FigureTableSnapshotManagergetManager()TableSnapshotgetReplicatedTableSnapshot()Map<String,Object>getSnapshotData()TableDefinitiongetTableDefinition()Gets the signature (columns and types) of the table, \even if the data is transformed.TableMapHandlegetTableMapHandle()Gets theTableHandlefor this SwappableTable.protected voidinvokeRecompute()protected abstract voidlocalRecomputeComplete()protected voidmaybeInitializeTransient()voidremoveLocalTableUpdateListener(SwappableTable.LocalTableUpdateListener listener)Removes a listener to the update list.voidsetManager(FigureTableSnapshotManager manager)booleantableCalculationChanged(KEY_TYPE key, VALUE_TYPE value)Updates the local table with the specified calculation.booleanthawSnapshots()voidunsubscribeLocalTable()protected abstract booleanupdateState(KEY_TYPE key, VALUE_TYPE value)Update the state for a given column selection.
-
Field Details
-
Constructor Details
-
SwappableTable
Creates a SwappableTable instance with thetableHandle.- Parameters:
tableMapHandle- holds the table
-
-
Method Details
-
getTableMapHandle
Gets theTableHandlefor this SwappableTable.- Returns:
- this SwappableTable's
TableHandle
-
addColumn
Adds a column to the underlying table structures.- Parameters:
column- column
-
getTableDefinition
Gets the signature (columns and types) of the table, \even if the data is transformed.- Returns:
- table with the columns and types of the final table
-
updateState
Update the state for a given column selection.- Parameters:
key- key for table calculationvalue- value for table calculation- Returns:
- whether this table should recompute
-
computeRemoteTable
Computes the remote table.- Returns:
- computed remote table
-
tableCalculationChanged
Updates the local table with the specified calculation.- Parameters:
key- keyvalue- value- Returns:
- true if the table calculation changed
-
invokeRecompute
protected void invokeRecompute() -
getFriendlyName
Get a readable name for use with threads/logs etc.- Returns:
- a name to use
-
localRecomputeComplete
protected abstract void localRecomputeComplete() -
setManager
-
getManager
-
getReplicatedTableSnapshot
-
freezeSnapshots
public void freezeSnapshots() -
thawSnapshots
public boolean thawSnapshots() -
getSnapshotData
-
addLocalTableUpdateListener
Adds a listener to the update list. Thelistenerwill be notified of local table updates.- Parameters:
listener- listener- Returns:
- current local table
-
removeLocalTableUpdateListener
Removes a listener to the update list.- Parameters:
listener- listener
-
addDataChangeListener
Adds a listener to the update list. Thelistenerwill be notified of data changes.- Parameters:
listener- listener
-
unsubscribeLocalTable
public void unsubscribeLocalTable() -
maybeInitializeTransient
protected void maybeInitializeTransient() -
beginBatchUpdate
protected void beginBatchUpdate() -
endBatchUpdate
protected void endBatchUpdate()
-