gov.sandia.cognition.framework.lite
Class SimplePatternRecognizerState

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.framework.lite.SimplePatternRecognizerState
All Implemented Interfaces:
CognitiveModuleState, CloneableSerializable, Serializable, Cloneable

public class SimplePatternRecognizerState
extends AbstractCloneableSerializable
implements CognitiveModuleState

The 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.

Since:
1.0
Author:
Justin Basilico
See Also:
Serialized Form

Constructor Summary
SimplePatternRecognizerState(Collection<SemanticLabel> labels)
          Creates a new instance of SimplePatternRecognizerState.
SimplePatternRecognizerState(Collection<SemanticLabel> labels, Vector stateVector)
          Creats a new instance of SimplePatternRecognizerState.
SimplePatternRecognizerState(Collection<SemanticLabel> labels, Vector stateVector, boolean copyState)
          Creats a new instance of SimplePatternRecognizerState.
SimplePatternRecognizerState(SimplePatternRecognizerState other)
          Creats a new instance of SimplePatternRecognizerState.
 
Method Summary
 SimplePatternRecognizerState clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 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(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.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplePatternRecognizerState

public SimplePatternRecognizerState(Collection<SemanticLabel> labels)
Creates a new instance of SimplePatternRecognizerState.

Parameters:
labels - The labels of the elements of the state vector.

SimplePatternRecognizerState

public SimplePatternRecognizerState(Collection<SemanticLabel> labels,
                                    Vector stateVector)
Creats a new instance of SimplePatternRecognizerState.

Parameters:
labels - The labels of the elements of the state vector.
stateVector - The state vector.

SimplePatternRecognizerState

public SimplePatternRecognizerState(Collection<SemanticLabel> labels,
                                    Vector stateVector,
                                    boolean copyState)
Creats a new instance of SimplePatternRecognizerState.

Parameters:
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.

SimplePatternRecognizerState

public SimplePatternRecognizerState(SimplePatternRecognizerState other)
Creats a new instance of SimplePatternRecognizerState.

Parameters:
other - The SimplePatternRecognizerState to copy.
Method Detail

clone

public SimplePatternRecognizerState clone()
This makes public the clone method on the 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.

Specified by:
clone in interface CognitiveModuleState
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

getLabels

public List<SemanticLabel> getLabels()
Gets the labels corresponding to the dimensions of the state.

Returns:
The list of labels used by the state.

getStateVector

public Vector getStateVector()
Gets the state vector stored in the object, which contains the main state data of the recognizer.

Returns:
The state vector.

setLabels

public void setLabels(Collection<SemanticLabel> labels)
Sets the labels for the state to keep as the labels of the dimensions of the state. It makes its own copy of the labels so that the given object can change but the state will remain the same.

Parameters:
labels - The labels for the dimensions of the state vector.

setStateVector

public void setStateVector(Vector stateVector)
Sets the state vector stored in the state object. It is not copied.

Parameters:
stateVector - The state vector to store in the state object.