update
public CognitiveModuleState update(CognitiveModelState modelState,
CognitiveModuleState previousModuleState)
This method provides backwards compatibility with the basic,
non-concurrent CognitiveModule interface. It calls readState, evaluate,
and writeState in sequence to update the state of the model in one step
by modifying the given CognitiveModelState object. As such, no
concurrency of module evaluation is possible when calling this method.
To achieve concurrent evaluation, readState, evaluate, and writeState
should be called separately in the context of the update method of a
concurrent implementation of the CognitiveModel interface (see, for
example, the MutlithreadedCognitiveModel implementation)
Since a module is not to store any local state information, it is given
its previous CognitiveModuleState object in order to provide the
information about its state. It then returns its updated
CognitiveModuleState as the result of the update method.
- Specified by:
update
in interface CognitiveModule
- Parameters:
modelState
- The CognitiveModelState to update
previousModuleState
- The previous CognitiveModuleState returned
by this module
- Returns:
- The updated CognitiveModuleState for this module