gov.sandia.cognition.data.convert.vector
Class AbstractToVectorEncoder<InputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.data.convert.AbstractDataConverter<InputType,Vector>
          extended by gov.sandia.cognition.data.convert.vector.AbstractToVectorEncoder<InputType>
Type Parameters:
InputType - The type of input data to be encoded into a Vector.
All Implemented Interfaces:
DataConverter<InputType,Vector>, DataToVectorEncoder<InputType>, Evaluator<InputType,Vector>, VectorOutputEvaluator<InputType,Vector>, CloneableSerializable, Serializable, Cloneable
Direct Known Subclasses:
NumberConverterToVectorAdapter, NumberToVectorEncoder, UniqueBooleanVectorEncoder

public abstract class AbstractToVectorEncoder<InputType>
extends AbstractDataConverter<InputType,Vector>
implements DataToVectorEncoder<InputType>

An abstract implementation of the DataToVectorEncoder interface. It chains together the typical calls to create a vector and allows a vector factory to be stored on the encoder.

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

Field Summary
protected  VectorFactory<?> vectorFactory
          The vector factory to use to create new vectors.
 
Constructor Summary
AbstractToVectorEncoder()
          Creates a new AbstractToVectorEncoder.
AbstractToVectorEncoder(VectorFactory<?> vectorFactory)
          Creates a new AbstractToVectorEncoder with the given vector factory.
 
Method Summary
 void encode(InputType object, Vector vector)
          Encodes the given object into the given Vector.
 Vector evaluate(InputType input)
          Converts the given object to a Vector.
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.data.convert.vector.DataToVectorEncoder
encode, getOutputDimensionality
 

Field Detail

vectorFactory

protected VectorFactory<?> vectorFactory
The vector factory to use to create new vectors.

Constructor Detail

AbstractToVectorEncoder

public AbstractToVectorEncoder()
Creates a new AbstractToVectorEncoder.


AbstractToVectorEncoder

public AbstractToVectorEncoder(VectorFactory<?> vectorFactory)
Creates a new AbstractToVectorEncoder with the given vector factory.

Parameters:
vectorFactory - The VectorFactory to use.
Method Detail

evaluate

public Vector evaluate(InputType input)
Converts the given object to a Vector.

Specified by:
evaluate in interface Evaluator<InputType,Vector>
Parameters:
input - The object to convert.
Returns:
The Vector representing the object.

encode

public void encode(InputType object,
                   Vector vector)
Description copied from interface: DataToVectorEncoder
Encodes the given object into the given Vector. It starts at index zero in the Vector.

Specified by:
encode in interface DataToVectorEncoder<InputType>
Parameters:
object - The object to encode.
vector - The vector to encode the object into.