public class SimplePatternRecognizerState extends AbstractCloneableSerializable implements CognitiveModuleState
SimplePatternRecognizerState
class implements a
CognitiveModuleState
for the
SimplePatternRecognizer
. It stores a state vector along with
the labels for the dimensions of the vector. The labels are stored as a
copy of the labels on the module so that if the module has labels added or
removed the state's copy will not be changed. This allows the module to map
the state activations properly even when the module has changed.Constructor and Description |
---|
SimplePatternRecognizerState(java.util.Collection<SemanticLabel> labels)
Creates a new instance of SimplePatternRecognizerState.
|
SimplePatternRecognizerState(java.util.Collection<SemanticLabel> labels,
Vector stateVector)
Creats a new instance of SimplePatternRecognizerState.
|
SimplePatternRecognizerState(java.util.Collection<SemanticLabel> labels,
Vector stateVector,
boolean copyState)
Creats a new instance of SimplePatternRecognizerState.
|
SimplePatternRecognizerState(SimplePatternRecognizerState other)
Creats a new instance of SimplePatternRecognizerState.
|
Modifier and Type | Method and Description |
---|---|
SimplePatternRecognizerState |
clone()
This makes public the clone method on the
Object class and
removes the exception that it throws. |
java.util.List<SemanticLabel> |
getLabels()
Gets the labels corresponding to the dimensions of the state.
|
Vector |
getStateVector()
Gets the state vector stored in the object, which contains the main
state data of the recognizer.
|
void |
setLabels(java.util.Collection<SemanticLabel> labels)
Sets the labels for the state to keep as the labels of the dimensions
of the state.
|
void |
setStateVector(Vector stateVector)
Sets the state vector stored in the state object.
|
public SimplePatternRecognizerState(java.util.Collection<SemanticLabel> labels)
labels
- The labels of the elements of the state vector.public SimplePatternRecognizerState(java.util.Collection<SemanticLabel> labels, Vector stateVector)
labels
- The labels of the elements of the state vector.stateVector
- The state vector.public SimplePatternRecognizerState(java.util.Collection<SemanticLabel> labels, Vector stateVector, boolean copyState)
labels
- The labels of the elements of the state vector.stateVector
- The state vector.copyState
- True to make a copy of the state, false to just use
the given object as a reference.public SimplePatternRecognizerState(SimplePatternRecognizerState other)
other
- The SimplePatternRecognizerState to copy.public SimplePatternRecognizerState clone()
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.clone
in interface CognitiveModuleState
clone
in interface CloneableSerializable
clone
in class AbstractCloneableSerializable
public java.util.List<SemanticLabel> getLabels()
public Vector getStateVector()
public void setLabels(java.util.Collection<SemanticLabel> labels)
labels
- The labels for the dimensions of the state vector.public void setStateVector(Vector stateVector)
stateVector
- The state vector to store in the state object.