InputType
- Input type of the embedded EvaluatorOutputType
- Output type of the embedded Evaluatorpublic class EvaluatorBasedCognitiveModule<InputType,OutputType> extends AbstractConcurrentCognitiveModule
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_NAME
Default name given to modules of this type
|
protected InputType |
input
A place to temporarily store the input read in by a call to readState;
this temporary store is blown away as soon as it used by evaluate,
because we NEVER retain state interally across module update cycles
|
protected OutputType |
output
A place to temporarily store the output generated by a call to evaluate;
this temporary store is blown away as soon as it used by evaluate,
because we NEVER retain state interally across module update cycles
|
Constructor and Description |
---|
EvaluatorBasedCognitiveModule(CognitiveModel model,
EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings,
java.lang.String name)
Creates a new instance of EvaluatorBasedCognitiveModule.
|
Modifier and Type | Method and Description |
---|---|
void |
evaluate()
Perform evaluation of sampled and held input state information that
was captured by a call to readState, and hold the resultant output
changes to model and module state pending a call to writeState
NOTE: input and output state is held temporarily for the sole purpose
of supporting concurrency of module evaluation; state is NEVER
retained locally across module update cycles
|
Evaluator<? super InputType,? extends OutputType> |
getEvaluator()
Gets the underlying evaluator that is being wrapped in this module.
|
CogxelConverter<InputType> |
getInputConverter()
Gets the input converter that is used to map from Cogxels to the
InputType.
|
java.lang.String |
getName()
Gets the human-readable name of module.
|
CogxelConverter<OutputType> |
getOutputConverter()
Gets the output converter that is used to map from the OutputType to
Cogxels.
|
EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> |
getSettings()
Gets the settings for the module, which can be used to create another
instantation of a module.
|
CognitiveModuleState |
initializeState(CognitiveModelState modelState)
This method initializes the state object for a CognitiveModel by adding
any necessary information to the model state and returining the default
state for the module.
|
void |
readState(CognitiveModelState modelState,
CognitiveModuleState previousModuleState)
Read in and temporarily hold input state information required for
performing module evaluation.
|
void |
setName(java.lang.String name)
Sets the name of the module
|
protected void |
setSettings(EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings)
Sets the settings of the module.
|
CognitiveModuleState |
writeState(CognitiveModelState modelState)
Write out the model and module state changes resulting from a call to
evaluate
NOTE: output state was held temporarily for the sole purpose
of supporting concurrency of module evaluation; state is NEVER
retained locally across module update cycles
|
update
protected InputType input
protected OutputType output
public static final java.lang.String DEFAULT_NAME
public EvaluatorBasedCognitiveModule(CognitiveModel model, EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings, java.lang.String name)
model
- The model to create the module for.settings
- The settings of the module.name
- High-level name of this modulepublic CognitiveModuleState initializeState(CognitiveModelState modelState)
modelState
- The CognitiveModelState to initalizepublic void readState(CognitiveModelState modelState, CognitiveModuleState previousModuleState)
modelState
- The CognitiveModelState to evaluate withpreviousModuleState
- The previous CognitiveModuleState returned
by this modulepublic void evaluate()
public CognitiveModuleState writeState(CognitiveModelState modelState)
modelState
- The CognitiveModelState to updatepublic java.lang.String getName()
public void setName(java.lang.String name)
name
- Name to assign to the modulepublic EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> getSettings()
protected void setSettings(EvaluatorBasedCognitiveModuleSettings<InputType,OutputType> settings)
settings
- The module's settings.public Evaluator<? super InputType,? extends OutputType> getEvaluator()
public CogxelConverter<InputType> getInputConverter()
public CogxelConverter<OutputType> getOutputConverter()