gov.sandia.cognition.learning.data.feature
Class DelayFunction<DataType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.evaluator.AbstractStatefulEvaluator<DataType,DataType,FiniteCapacityBuffer<DataType>>
          extended by gov.sandia.cognition.learning.data.feature.DelayFunction<DataType>
Type Parameters:
DataType - The type of data to delay.
All Implemented Interfaces:
Evaluator<DataType,DataType>, StatefulEvaluator<DataType,DataType,FiniteCapacityBuffer<DataType>>, CloneableSerializable, Serializable, Cloneable

public class DelayFunction<DataType>
extends AbstractStatefulEvaluator<DataType,DataType,FiniteCapacityBuffer<DataType>>

Delays the input and returns the input from the parameterized number of samples previous.

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

Constructor Summary
DelayFunction()
          Default constructor.
DelayFunction(DelayFunction<DataType> other)
          Copy Constructor
DelayFunction(int delaySamples)
          Creates a new instance of DelayFunction
 
Method Summary
 DelayFunction<DataType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 FiniteCapacityBuffer<DataType> createDefaultState()
          Creates a new default state object.
 DataType evaluate(DataType input)
          Returns the input from delaySamples previous evalutes
 int getDelaySamples()
          Getter for delaySamples
 void setDelaySamples(int delaySamples)
          Setter for delaySamples
 
Methods inherited from class gov.sandia.cognition.evaluator.AbstractStatefulEvaluator
evaluate, getState, resetState, setState
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelayFunction

public DelayFunction()
Default constructor.


DelayFunction

public DelayFunction(int delaySamples)
Creates a new instance of DelayFunction

Parameters:
delaySamples - Number of samples to delay the value

DelayFunction

public DelayFunction(DelayFunction<DataType> other)
Copy Constructor

Parameters:
other - DelayFunction to copy
Method Detail

clone

public DelayFunction<DataType> 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 CloneableSerializable
Overrides:
clone in class AbstractStatefulEvaluator<DataType,DataType,FiniteCapacityBuffer<DataType>>
Returns:
A clone of this object.

getDelaySamples

public int getDelaySamples()
Getter for delaySamples

Returns:
Number of samples to delay the value

setDelaySamples

public void setDelaySamples(int delaySamples)
Setter for delaySamples

Parameters:
delaySamples - Number of samples to delay the value

createDefaultState

public FiniteCapacityBuffer<DataType> createDefaultState()
Description copied from interface: StatefulEvaluator
Creates a new default state object.

Returns:
A new default state object.

evaluate

public DataType evaluate(DataType input)
Returns the input from delaySamples previous evalutes

Parameters:
input - Input to store into the buffer
Returns:
input from delaySamples ago, will return oldest sample if there are fewer than "delaySamples" in the buffer