Class ConditionalModels<DATA_TYPE,STATE_TYPE,KEY_TYPE>

java.lang.Object
io.deephaven.modelfarm.ConditionalModels<DATA_TYPE,STATE_TYPE,KEY_TYPE>
All Implemented Interfaces:
ModelMultiExec.Models<DATA_TYPE>

public class ConditionalModels<DATA_TYPE,STATE_TYPE,KEY_TYPE> extends Object implements ModelMultiExec.Models<DATA_TYPE>
A set of multiple models where predicates determine which of the models execute on any iteration. The predicates use input data and the most recent state for an underlying to determine which models should execute on an iteration. For example, the state could be the most recent valid result from a numerical model.

Active models are executed in their input order.

  • Constructor Details

    • ConditionalModels

      public ConditionalModels(Model<DATA_TYPE>[] models, BiPredicate<DATA_TYPE,STATE_TYPE>[] predicates, Map<KEY_TYPE,STATE_TYPE> stateMap, Function<DATA_TYPE,KEY_TYPE> dataToKey)
      Creates a new set of conditionally active models.

      Active models are executed in their input order.

      Parameters:
      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!
      dataToKey - function to get a key from data.
  • Method Details