public class ConditionalModels<DATA_TYPE extends FitDataUnderlying,STATE_TYPE> extends Object implements ModelMultiExec.Models<DATA_TYPE>
Active models are executed in their input order.
Constructor and Description |
---|
ConditionalModels(Model<DATA_TYPE>[] models,
BiPredicate<DATA_TYPE,STATE_TYPE>[] predicates,
Map<Long,STATE_TYPE> stateMap)
Creates a new set of conditionally active models.
|
Modifier and Type | Method and Description |
---|---|
Object |
getLock(DATA_TYPE data)
Gets the synchronization lock to hold while executing the models in the iterator.
|
Iterator<Model<DATA_TYPE>> |
iterator(DATA_TYPE data)
Creates an iterator for the models to exec for the model data instance.
|
public ConditionalModels(Model<DATA_TYPE>[] models, BiPredicate<DATA_TYPE,STATE_TYPE>[] predicates, Map<Long,STATE_TYPE> stateMap)
Active models are executed in their input order.
models
- models to execute.predicates
- predicates used to determine if each model should execute.stateMap
- map of state by underlying id. THIS MAP SHOULD BE THREAD SAFE, OR RESULTS WILL BE UNPREDICTABLE!public Object getLock(DATA_TYPE data)
ModelMultiExec.Models
getLock
in interface ModelMultiExec.Models<DATA_TYPE extends FitDataUnderlying>
data
- model datapublic Iterator<Model<DATA_TYPE>> iterator(DATA_TYPE data)
ModelMultiExec.Models
iterator
in interface ModelMultiExec.Models<DATA_TYPE extends FitDataUnderlying>
data
- model data