gov.sandia.cognition.framework.concurrent
Class AbstractConcurrentCognitiveModule

java.lang.Object
  extended by gov.sandia.cognition.framework.concurrent.AbstractConcurrentCognitiveModule
All Implemented Interfaces:
CognitiveModule, ConcurrentCognitiveModule, Serializable
Direct Known Subclasses:
ArrayBasedPerceptionModule, EvaluatorBasedCognitiveModule

public abstract class AbstractConcurrentCognitiveModule
extends Object
implements ConcurrentCognitiveModule

The AbstractConcurrentCognitiveModule class is an abstract class that implements common functionality of classes that implement the ConcurrentCognitiveModule interface.

Since:
2.0
Author:
Zachary Benz
See Also:
Serialized Form

Constructor Summary
AbstractConcurrentCognitiveModule()
           
 
Method Summary
 CognitiveModuleState update(CognitiveModelState modelState, CognitiveModuleState previousModuleState)
          This method provides backwards compatibility with the basic, non-concurrent CognitiveModule interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.framework.concurrent.ConcurrentCognitiveModule
evaluate, readState, writeState
 
Methods inherited from interface gov.sandia.cognition.framework.CognitiveModule
getName, getSettings, initializeState
 

Constructor Detail

AbstractConcurrentCognitiveModule

public AbstractConcurrentCognitiveModule()
Method Detail

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