Package io.deephaven.modelfarm
Class RDMModelFarm<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
java.lang.Object
io.deephaven.modelfarm.ModelFarmBase<DATATYPE>
io.deephaven.modelfarm.RDMModelFarm<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE>
- Type Parameters:
KEYTYPE
- The type of keys.DATATYPE
- The type of data.ROWDATAMANAGERTYPE
- The type of RowDataManager.
- All Implemented Interfaces:
ModelFarm
- Direct Known Subclasses:
ModelFarmRealTime
,ModelFarmTick
public abstract class RDMModelFarm<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
extends ModelFarmBase<DATATYPE>
Abstract class for ModelFarm implementations that will take data from a
RowDataManager
. This class tracks the
mappings between each key and the corresponding index in the RowDataManager
's table
. Each row of this table should contain all of the data necessary to populate an instance of DATATYPE
,
which will then be passed to the model
.-
Nested Class Summary
Nested classes/interfaces inherited from class io.deephaven.modelfarm.ModelFarmBase
ModelFarmBase.GetDataLockType, ModelFarmBase.State
-
Field Summary
Fields inherited from class io.deephaven.modelfarm.ModelFarmBase
model
-
Constructor Summary
ConstructorDescriptionRDMModelFarm
(int nThreads, Model<DATATYPE> model, ROWDATAMANAGERTYPE dataManager) Create a multithreaded resource to execute data driven models. -
Method Summary
Modifier and TypeMethodDescriptionReturns a function that takes a key and returns an instance ofDATATYPE
that contains the most recent data for that key.protected void
Method called after the model farm threads have been started.protected abstract void
onDataUpdate
(RowSet added, RowSet removed, RowSet modified) Process a change to the data table.Methods inherited from class io.deephaven.modelfarm.ModelFarmBase
awaitTermination, awaitTermination, execute, getDoLockedConsumer, getState, isQueueEmpty, shutdown, shutdownAndAwaitTermination, shutdownAndAwaitTermination, start, terminate, toString
-
Field Details
-
dataManager
-
-
Constructor Details
-
RDMModelFarm
Create a multithreaded resource to execute data driven models.- Parameters:
nThreads
- number of worker threads.model
- model to execute.dataManager
- interface for accessing and querying data contained in rows of a dynamic table.
-
-
Method Details
-
modelFarmStarted
protected void modelFarmStarted()Description copied from class:ModelFarmBase
Method called after the model farm threads have been started. Implementing classes can override this to perform additional setup (e.g. creating and starting listeners). The default implementation does nothing.- Specified by:
modelFarmStarted
in classModelFarmBase<DATATYPE>
-
onDataUpdate
Process a change to the data table. If the data table is being accessed, use the protected column source fields.- Parameters:
added
- new indexes added to the data tableremoved
- indexes removed from the data tablemodified
- indexes modified in the data table.
-
getMostRecentDataFactory
protected io.deephaven.modelfarm.ModelFarmBase.MostRecentDataGetter<KEYTYPE,DATATYPE> getMostRecentDataFactory(ModelFarmBase.GetDataLockType lockType) Returns a function that takes a key and returns an instance ofDATATYPE
that contains the most recent data for that key. The returned function will retrieve the data using the specifiedlockType
.- Parameters:
lockType
- locking algorithm used to ensure that data read from the table is consistent.- Returns:
- function to retrieve the most recent row data for a unique identifier.
-