gov.sandia.cognition.framework.learning.converter
Class CogxelBooleanConverter

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.framework.learning.converter.AbstractCogxelConverter<Boolean>
          extended by gov.sandia.cognition.framework.learning.converter.CogxelBooleanConverter
All Implemented Interfaces:
CogxelConverter<Boolean>, CloneableSerializable, Serializable, Cloneable

public class CogxelBooleanConverter
extends AbstractCogxelConverter<Boolean>

Implements a CogxelConverter that encodes booleans as positive and negative values (+1/-1).

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

Field Summary
 
Fields inherited from class gov.sandia.cognition.framework.learning.converter.AbstractCogxelConverter
semanticIdentifierMap
 
Constructor Summary
CogxelBooleanConverter()
          Creates a new instance of CogxelBooleanConverter.
CogxelBooleanConverter(SemanticLabel label)
          Creates a new instance of CogxelDoubleConverter.
CogxelBooleanConverter(SemanticLabel label, SemanticIdentifierMap semanticIdentifierMap)
          Creates a new instance of CogxelBooleanConverter.
CogxelBooleanConverter(SemanticLabel label, SemanticIdentifierMap semanticIdentifierMap, CogxelFactory cogxelFactory)
          Creates a new instance of CogxelBooleanConverter.
 
Method Summary
protected  void buildIdentifierCache()
          Rebuilds the cache of SemanticIdentifier objects.
 CogxelBooleanConverter clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 boolean equals(CogxelBooleanConverter other)
          This converter equals another converter of the same type if their labels are equal.
 boolean equals(Object other)
           
 Boolean fromCogxels(CogxelState cogxels)
          Converts from a CogxelState object to an object of type DataType.
 CogxelFactory getCogxelFactory()
          Gets the CogxelFactory used to create the cogxels used by the converter.
protected  SemanticIdentifier getIdentifier()
          Gets the semantic identifier of the cogxel to convert.
 SemanticLabel getLabel()
          Gets the label of the cogxel to convert.
 int hashCode()
           
 void setCogxelFactory(CogxelFactory cogxelFactory)
          Gets the CogxelFactory used to create the cogxels used by the converter.
protected  void setIdentifier(SemanticIdentifier identifier)
          Gets the semantic identifier of the cogxel to convert.
 void setLabel(SemanticLabel label)
          Sets the label of the cogxel to convert.
 void toCogxels(Boolean data, CogxelState cogxels)
          Converts from an object of type DataType to an updated CogxelState.
 
Methods inherited from class gov.sandia.cognition.framework.learning.converter.AbstractCogxelConverter
getSemanticIdentifierMap, setSemanticIdentifierMap
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CogxelBooleanConverter

public CogxelBooleanConverter()
Creates a new instance of CogxelBooleanConverter.


CogxelBooleanConverter

public CogxelBooleanConverter(SemanticLabel label)
Creates a new instance of CogxelDoubleConverter.

Parameters:
label - The label for the Cogxel to convert.

CogxelBooleanConverter

public CogxelBooleanConverter(SemanticLabel label,
                              SemanticIdentifierMap semanticIdentifierMap)
Creates a new instance of CogxelBooleanConverter.

Parameters:
label - The label for the Cogxel to convert.
semanticIdentifierMap - The SemanticIdentifierMap for the converter.

CogxelBooleanConverter

public CogxelBooleanConverter(SemanticLabel label,
                              SemanticIdentifierMap semanticIdentifierMap,
                              CogxelFactory cogxelFactory)
Creates a new instance of CogxelBooleanConverter.

Parameters:
label - The label for the Cogxel to convert.
semanticIdentifierMap - The SemanticIdentifierMap for the converter.
cogxelFactory - The CogxelFactory to use.
Method Detail

clone

public CogxelBooleanConverter clone()
Description copied from class: AbstractCloneableSerializable
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 CogxelConverter<Boolean>
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCogxelConverter<Boolean>
Returns:
A clone of this object.

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(CogxelBooleanConverter other)
This converter equals another converter of the same type if their labels are equal.

Parameters:
other - The other converter.
Returns:
True if the two objects are equal; otherwise, false.

buildIdentifierCache

protected void buildIdentifierCache()
Description copied from class: AbstractCogxelConverter
Rebuilds the cache of SemanticIdentifier objects. Should only need to be called after the SemanticIdentifierMap is changed.

Overrides:
buildIdentifierCache in class AbstractCogxelConverter<Boolean>

fromCogxels

public Boolean fromCogxels(CogxelState cogxels)
Description copied from interface: CogxelConverter
Converts from a CogxelState object to an object of type DataType.

Parameters:
cogxels - The CogxelState to convert to DataType.
Returns:
An object of DataType extracted from the given CogxelState.

toCogxels

public void toCogxels(Boolean data,
                      CogxelState cogxels)
Description copied from interface: CogxelConverter
Converts from an object of type DataType to an updated CogxelState.

Parameters:
data - The object to convert into the CogxelState.
cogxels - The CogxelState to update with the converted data.

getLabel

public SemanticLabel getLabel()
Gets the label of the cogxel to convert.

Returns:
The label of the cogxel to convert.

setLabel

public void setLabel(SemanticLabel label)
Sets the label of the cogxel to convert.

Parameters:
label - The label of the cogxel to convert.

getIdentifier

protected SemanticIdentifier getIdentifier()
Gets the semantic identifier of the cogxel to convert.

Returns:
The semantic identifier of the cogxel to convert.

setIdentifier

protected void setIdentifier(SemanticIdentifier identifier)
Gets the semantic identifier of the cogxel to convert.

Parameters:
identifier - The semantic identifier of the cogxel to convert.

getCogxelFactory

public CogxelFactory getCogxelFactory()
Gets the CogxelFactory used to create the cogxels used by the converter.

Returns:
The CogxelFactory used to create the cogxels used by the converter.

setCogxelFactory

public void setCogxelFactory(CogxelFactory cogxelFactory)
Gets the CogxelFactory used to create the cogxels used by the converter.

Parameters:
cogxelFactory - The CogxelFactory used to create the cogxels used by the converter.