gpsys.primitives
Class ConstantDouble

java.lang.Object
  |
  +--gpsys.Primitive
        |
        +--gpsys.Terminal
              |
              +--gpsys.primitives.ConstantDouble

public class ConstantDouble
extends Terminal

	DOUBLE ConstantDouble
 
Creates a Terminal representing an ephemeral random constant of Type DOUBLE.

Version:
$Revision: 1.1 $, $Date: 2000/07/05 16:24:33 $
Author:
Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
See Also:
Type, Primitive, Terminal, Serialized Form

Field Summary
 double d
          The value of this constant.
private  double from
          The smallest value that this constant can take.
private  java.util.Random rng
          The random number generator used to create this constant.
private  double to
          The largest value that this constant can take.
 
Fields inherited from class gpsys.Primitive
type
 
Constructor Summary
ConstantDouble(java.util.Random rng, double from, double to)
          Create a ephemeral random constant of type double in the range between from and to using the random number generator rng.
 
Method Summary
 double evaluateDouble(Individual i)
          Evaluate this Terminal.
 Primitive instance()
          Creates a new DOUBLE constant in exactly the same range as this constant, and using the same random number generator.
 java.lang.String toString()
          Returns the value of the constant as a String.
 
Methods inherited from class gpsys.Terminal
evaluateBoolean, evaluateByte, evaluateChar, evaluateFloat, evaluateInt, evaluateLong, evaluateObject, evaluateShort
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

d

public double d
The value of this constant.

from

private double from
The smallest value that this constant can take.

to

private double to
The largest value that this constant can take.

rng

private java.util.Random rng
The random number generator used to create this constant.
Constructor Detail

ConstantDouble

public ConstantDouble(java.util.Random rng,
                      double from,
                      double to)
Create a ephemeral random constant of type double in the range between from and to using the random number generator rng.
Parameters:
rng - The random number generator to be used.
from - The smallest value that the constant can take.
to - The largest value that the constant can take.
Method Detail

evaluateDouble

public final double evaluateDouble(Individual i)
                            throws EvaluationException
Evaluate this Terminal.
Parameters:
i - The individual being evaluated.
Returns:
The value of the constant.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateDouble in class Terminal

instance

public final Primitive instance()
Creates a new DOUBLE constant in exactly the same range as this constant, and using the same random number generator.
Returns:
A new DOUBLE constant in exactly the same range.
Overrides:
instance in class Primitive

toString

public java.lang.String toString()
Returns the value of the constant as a String.
Returns:
A String representing the value of this constant.
Overrides:
toString in class Primitive