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

java.lang.Object
  extended by gov.sandia.cognition.framework.learning.converter.CogxelDoubleConverter
All Implemented Interfaces:
CogxelConverter<Double>, CloneableSerializable, Serializable, Cloneable

public class CogxelDoubleConverter
extends Object
implements CogxelConverter<Double>

The CogxelDoubleConverter class converts a Cogxel to and from a double value by using its activation.

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

Constructor Summary
CogxelDoubleConverter()
          Creates a new instance of CogxelDoubleConverter.
CogxelDoubleConverter(CogxelDoubleConverter other)
          Creates a new instance of CogxelDoubleConverter.
CogxelDoubleConverter(SemanticLabel label)
          Creates a new instance of CogxelDoubleConverter.
CogxelDoubleConverter(SemanticLabel label, SemanticIdentifierMap semanticIdentifierMap)
          Creates a new instance of CogxelDoubleConverter.
CogxelDoubleConverter(SemanticLabel label, SemanticIdentifierMap semanticIdentifierMap, CogxelFactory cogxelFactory)
          Creates a new instance of CogxelDoubleConverter.
 
Method Summary
protected  void buildIdentifierCache()
          Rebuilds the cache of SemanticIdentifier objects.
 CogxelDoubleConverter clone()
          Creates a new clone (shallow copy) of this object.
 boolean equals(CogxelDoubleConverter other)
          Returns true if the two converters have the same label.
 boolean equals(Object other)
          
 Double 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.
 SemanticIdentifierMap getSemanticIdentifierMap()
          Gets the SemanticIdentifierMap used by this converter.
 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 setSemanticIdentifierMap(SemanticIdentifierMap semanticIdentifierMap)
          Sets the SemanticIdentifierMap that the converter is to use.
 void toCogxels(Double data, CogxelState cogxels)
          Converts from an object of type DataType to an updated CogxelState.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CogxelDoubleConverter

public CogxelDoubleConverter()
Creates a new instance of CogxelDoubleConverter.


CogxelDoubleConverter

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

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

CogxelDoubleConverter

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

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

CogxelDoubleConverter

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

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

CogxelDoubleConverter

public CogxelDoubleConverter(CogxelDoubleConverter other)
Creates a new instance of CogxelDoubleConverter.

Parameters:
other - A CogxelDoubleConverter to copy.
Method Detail

clone

public CogxelDoubleConverter clone()
Creates a new clone (shallow copy) of this object.

Specified by:
clone in interface CogxelConverter<Double>
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class Object
Returns:
A new clone (shallow copy) of this object.

equals

public boolean equals(Object other)

Overrides:
equals in class Object
Parameters:
other -
Returns:

equals

public boolean equals(CogxelDoubleConverter other)
Returns true if the two converters have the same label.

Parameters:
other - Another CogxelVectorConverter.
Returns:
True if the two converters have the same label.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

buildIdentifierCache

protected void buildIdentifierCache()
Rebuilds the cache of SemanticIdentifier objects. Should only need to be called after the SemanticIdentifierMap is changed.


fromCogxels

public Double fromCogxels(CogxelState cogxels)
Converts from a CogxelState object to an object of type DataType.

Specified by:
fromCogxels in interface CogxelConverter<Double>
Parameters:
cogxels - The CogxelState to convert to DataType.
Returns:
An object of DataType extracted from the given CogxelState.

toCogxels

public void toCogxels(Double data,
                      CogxelState cogxels)
Converts from an object of type DataType to an updated CogxelState.

Specified by:
toCogxels in interface CogxelConverter<Double>
Parameters:
data - The object to convert into the CogxelState.
cogxels - The CogxelState to update with the converted data.

getSemanticIdentifierMap

public SemanticIdentifierMap getSemanticIdentifierMap()
Gets the SemanticIdentifierMap used by this converter.

Specified by:
getSemanticIdentifierMap in interface CogxelConverter<Double>
Returns:
The SemanticIdentifierMap used by this converter.

setSemanticIdentifierMap

public void setSemanticIdentifierMap(SemanticIdentifierMap semanticIdentifierMap)
Sets the SemanticIdentifierMap that the converter is to use.

Specified by:
setSemanticIdentifierMap in interface CogxelConverter<Double>
Parameters:
semanticIdentifierMap - The SemanticIdentifierMap the converter is to use.

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.