gov.sandia.cognition.framework.learning.converter
Class AbstractCogxelPairConverter<FirstType,SecondType,PairType extends Pair<FirstType,SecondType>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.framework.learning.converter.AbstractCogxelConverter<PairType>
          extended by gov.sandia.cognition.framework.learning.converter.AbstractCogxelPairConverter<FirstType,SecondType,PairType>
Type Parameters:
FirstType - Type of the first element of the pair
SecondType - Type of the second element of the pair
PairType - Type of the pair
All Implemented Interfaces:
CogxelConverter<PairType>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
CogxelInputOutputPairConverter, CogxelTargetEstimatePairConverter

public abstract class AbstractCogxelPairConverter<FirstType,SecondType,PairType extends Pair<FirstType,SecondType>>
extends AbstractCogxelConverter<PairType>

Partial implementation of CogxelConverters based on a Pair

Since:
3.0
Author:
Kevin R. Dixon
See Also:
Serialized Form

Field Summary
 
Fields inherited from class gov.sandia.cognition.framework.learning.converter.AbstractCogxelConverter
semanticIdentifierMap
 
Constructor Summary
AbstractCogxelPairConverter()
          Creates a new instance of AbstractCogxelPairConverter
AbstractCogxelPairConverter(CogxelConverter<FirstType> firstConverter, CogxelConverter<SecondType> secondConverter)
          Creates a new instance of AbstractCogxelPairConverter
AbstractCogxelPairConverter(CogxelConverter<FirstType> firstConverter, CogxelConverter<SecondType> secondConverter, SemanticIdentifierMap semanticIdentifierMap)
          Creates a new instance of AbstractCogxelPairConverter
 
Method Summary
 AbstractCogxelPairConverter<FirstType,SecondType,PairType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
abstract  PairType createPair(FirstType first, SecondType second)
          Creates a Pair from the needed data
protected  boolean equals(AbstractCogxelPairConverter<?,?,?> other)
          Returns true if the two converters have equal internal converters.
 boolean equals(Object other)
           
 PairType fromCogxels(CogxelState cogxels)
          Converts from a CogxelState object to an object of type DataType.
 CogxelConverter<FirstType> getFirstConverter()
          Getter for firstConverter
 CogxelConverter<SecondType> getSecondConverter()
          Getter for secondConverter
 int hashCode()
           
 void setFirstConverter(CogxelConverter<FirstType> firstConverter)
          Setter for firstConverter
 void setSecondConverter(CogxelConverter<SecondType> secondConverter)
          Setter for secondConverter
 void setSemanticIdentifierMap(SemanticIdentifierMap semanticIdentifierMap)
          Sets the SemanticIdentifierMap that the converter is to use.
 void toCogxels(PairType 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
buildIdentifierCache, getSemanticIdentifierMap
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCogxelPairConverter

public AbstractCogxelPairConverter()
Creates a new instance of AbstractCogxelPairConverter


AbstractCogxelPairConverter

public AbstractCogxelPairConverter(CogxelConverter<FirstType> firstConverter,
                                   CogxelConverter<SecondType> secondConverter)
Creates a new instance of AbstractCogxelPairConverter

Parameters:
firstConverter - The CogxelConverter for the first element of the pair.
secondConverter - The CogxelConverter for the second element of the pair.

AbstractCogxelPairConverter

public AbstractCogxelPairConverter(CogxelConverter<FirstType> firstConverter,
                                   CogxelConverter<SecondType> secondConverter,
                                   SemanticIdentifierMap semanticIdentifierMap)
Creates a new instance of AbstractCogxelPairConverter

Parameters:
firstConverter - The CogxelConverter for the first element of the pair.
secondConverter - The CogxelConverter for the second element of the pair.
semanticIdentifierMap - The SemanticIdentifierMap for the converter.
Method Detail

clone

public AbstractCogxelPairConverter<FirstType,SecondType,PairType> 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<PairType extends Pair<FirstType,SecondType>>
Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCogxelConverter<PairType extends Pair<FirstType,SecondType>>
Returns:
A clone of this object.

equals

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

equals

protected boolean equals(AbstractCogxelPairConverter<?,?,?> other)
Returns true if the two converters have equal internal converters.

Parameters:
other - InputOutputPairCogxelConverter.
Returns:
True if the two converters have the same internal converters.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

createPair

public abstract PairType createPair(FirstType first,
                                    SecondType second)
Creates a Pair from the needed data

Parameters:
first - First element of the Pair
second - Second element of the Pair
Returns:
Pair with the given parameters

fromCogxels

public PairType 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(PairType 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.

setSemanticIdentifierMap

public void setSemanticIdentifierMap(SemanticIdentifierMap semanticIdentifierMap)
Description copied from interface: CogxelConverter
Sets the SemanticIdentifierMap that the converter is to use.

Specified by:
setSemanticIdentifierMap in interface CogxelConverter<PairType extends Pair<FirstType,SecondType>>
Overrides:
setSemanticIdentifierMap in class AbstractCogxelConverter<PairType extends Pair<FirstType,SecondType>>
Parameters:
semanticIdentifierMap - The SemanticIdentifierMap the converter is to use.

getFirstConverter

public CogxelConverter<FirstType> getFirstConverter()
Getter for firstConverter

Returns:
The CogxelConverter for the first element of the pair.

setFirstConverter

public void setFirstConverter(CogxelConverter<FirstType> firstConverter)
Setter for firstConverter

Parameters:
firstConverter - The CogxelConverter for the first element of the pair.

getSecondConverter

public CogxelConverter<SecondType> getSecondConverter()
Getter for secondConverter

Returns:
The CogxelConverter for the second element of the pair.

setSecondConverter

public void setSecondConverter(CogxelConverter<SecondType> secondConverter)
Setter for secondConverter

Parameters:
secondConverter - The CogxelConverter for the second element of the pair.