gov.sandia.cognition.data.convert.vector
Class NumberConverterToVectorAdapter<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>
              extended by gov.sandia.cognition.data.convert.vector.NumberConverterToVectorAdapter<InputType>
Type Parameters:
InputType - The input type to convert encode into a number, which is then adapted to be used in a Vector.
All Implemented Interfaces:
DataConverter<InputType,Vector>, DataToVectorEncoder<InputType>, Evaluator<InputType,Vector>, VectorOutputEvaluator<InputType,Vector>, CloneableSerializable, Serializable, Cloneable

public class NumberConverterToVectorAdapter<InputType>
extends AbstractToVectorEncoder<InputType>

Adapts a DataConverter that outputs a number to be a VectorEncoder.

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

Field Summary
protected  DataConverter<? super InputType,? extends Number> converter
          The converter to adapt for use with Vectors.
 
Fields inherited from class gov.sandia.cognition.data.convert.vector.AbstractToVectorEncoder
vectorFactory
 
Constructor Summary
NumberConverterToVectorAdapter()
          Creates a new NumberConverterToVectorAdapter.
NumberConverterToVectorAdapter(DataConverter<? super InputType,? extends Number> converter)
          Creates a new NumberConverterToVectorAdapter for the given converter.
 
Method Summary
 void encode(InputType object, Vector vector, int index)
          Encodes the given object into the vector at the given index by using the number converter that this object is adapting.
 DataConverter<? super InputType,? extends Number> getConverter()
          Gets the number converter being adapted to work with vectors.
 int getOutputDimensionality()
          Gets the dimensionality of this encoder, which is 1.
 void setConverter(DataConverter<? super InputType,? extends Number> converter)
          Sets the number converter being adapted to work with vectors.
 
Methods inherited from class gov.sandia.cognition.data.convert.vector.AbstractToVectorEncoder
encode, evaluate
 
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
 

Field Detail

converter

protected DataConverter<? super InputType,? extends Number> converter
The converter to adapt for use with Vectors.

Constructor Detail

NumberConverterToVectorAdapter

public NumberConverterToVectorAdapter()
Creates a new NumberConverterToVectorAdapter.


NumberConverterToVectorAdapter

public NumberConverterToVectorAdapter(DataConverter<? super InputType,? extends Number> converter)
Creates a new NumberConverterToVectorAdapter for the given converter.

Parameters:
converter - The converter to adapt.
Method Detail

encode

public void encode(InputType object,
                   Vector vector,
                   int index)
Encodes the given object into the vector at the given index by using the number converter that this object is adapting.

Parameters:
object - The input object to encode.
vector - The vector to encode into.
index - The index to encode at.

getOutputDimensionality

public int getOutputDimensionality()
Gets the dimensionality of this encoder, which is 1.

Returns:
The dimensionality of this encoder.

getConverter

public DataConverter<? super InputType,? extends Number> getConverter()
Gets the number converter being adapted to work with vectors.

Returns:
The adapted converter.

setConverter

public void setConverter(DataConverter<? super InputType,? extends Number> converter)
Sets the number converter being adapted to work with vectors.

Parameters:
converter - The adapted converter.