gov.sandia.cognition.learning.function
Class ConstantEvaluator<OutputType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.function.ConstantEvaluator<OutputType>
Type Parameters:
OutputType - The output type of the evaluator.
All Implemented Interfaces:
Evaluator<Object,OutputType>, CloneableSerializable, Serializable, Cloneable

public class ConstantEvaluator<OutputType>
extends AbstractCloneableSerializable
implements Evaluator<Object,OutputType>

The ConstantEvaluator class implements an Evaluator that always returns the same output value.

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

Field Summary
protected  OutputType value
          The output value.
 
Constructor Summary
ConstantEvaluator()
          Creates a new ConstantEvaluator.
ConstantEvaluator(OutputType value)
          Creates a new ConstantEvaluator.
 
Method Summary
static
<OutputType>
ConstantEvaluator<OutputType>
create(OutputType value)
          Creates a new ConstantEvaluator for the given value.
 OutputType evaluate(Object input)
          Evaluating this object just returns the constant output value.
 OutputType getValue()
          Gets the constant output value for the evaluator.
 void setValue(OutputType value)
          Sets the constant output value for the evaluator.
 
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

value

protected OutputType value
The output value.

Constructor Detail

ConstantEvaluator

public ConstantEvaluator()
Creates a new ConstantEvaluator.


ConstantEvaluator

public ConstantEvaluator(OutputType value)
Creates a new ConstantEvaluator.

Parameters:
value - The constant output value.
Method Detail

evaluate

public OutputType evaluate(Object input)
Evaluating this object just returns the constant output value.

Specified by:
evaluate in interface Evaluator<Object,OutputType>
Parameters:
input - The input (ignored).
Returns:
The constant output value.

getValue

public OutputType getValue()
Gets the constant output value for the evaluator.

Returns:
The constant output value.

setValue

public void setValue(OutputType value)
Sets the constant output value for the evaluator.

Parameters:
value - The constant output value.

create

public static <OutputType> ConstantEvaluator<OutputType> create(OutputType value)
Creates a new ConstantEvaluator for the given value.

Type Parameters:
OutputType - The output type for the evaluator
Parameters:
value - The constant to output.
Returns:
A new ConstantEvaluator that always returns the given value.