gpsys.primitives
Class One

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

public class One
extends Terminal

	<typeX> One
 
One is a generic Terminal which which represents the constant value one. One needs to be instantiated to return values for a particular type. Valid types include BYTE, SHORT, INT, LONG, FLOAT and 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

Fields inherited from class gpsys.Primitive
type
 
Constructor Summary
One(Type type)
          Constructs a constant of value one for the specified type.
 
Method Summary
 byte evaluateByte(Individual i)
          Used to get a BYTE value of the constant one.
 double evaluateDouble(Individual i)
          Used to get a DOUBLE value of the constant one.
 float evaluateFloat(Individual i)
          Used to get a FLOAT value of the constant one.
 int evaluateInt(Individual i)
          Used to get a INT value of the constant one.
 long evaluateLong(Individual i)
          Used to get a LONG value of the constant one.
 short evaluateShort(Individual i)
          Used to get a SHORT value of the constant one.
 Primitive instance()
          Creates an instance of this One object.
 java.lang.String toString()
          Returns a String representation of this Terminal.
 
Methods inherited from class gpsys.Terminal
evaluateBoolean, evaluateChar, evaluateObject
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Constructor Detail

One

public One(Type type)
Constructs a constant of value one for the specified type.
Parameters:
type - The required type of the One's value.
Method Detail

evaluateByte

public final byte evaluateByte(Individual i)
                        throws EvaluationException
Used to get a BYTE value of the constant one.
Parameters:
i - The individual being evaluated.
Returns:
A byte representing the value of the constant one.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateByte in class Terminal

evaluateShort

public final short evaluateShort(Individual i)
                          throws EvaluationException
Used to get a SHORT value of the constant one.
Parameters:
i - The individual being evaluated.
Returns:
A short representing the value of the constant one.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateShort in class Terminal

evaluateInt

public final int evaluateInt(Individual i)
                      throws EvaluationException
Used to get a INT value of the constant one.
Parameters:
i - The individual being evaluated.
Returns:
An int representing the value of the constant one.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateInt in class Terminal

evaluateLong

public final long evaluateLong(Individual i)
                        throws EvaluationException
Used to get a LONG value of the constant one.
Parameters:
i - The individual being evaluated.
Returns:
A long representing the value of the constant one.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateLong in class Terminal

evaluateFloat

public final float evaluateFloat(Individual i)
                          throws EvaluationException
Used to get a FLOAT value of the constant one.
Parameters:
i - The individual being evaluated.
Returns:
A float representing the value of the constant one.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateFloat in class Terminal

evaluateDouble

public final double evaluateDouble(Individual i)
                            throws EvaluationException
Used to get a DOUBLE value of the constant one.
Parameters:
i - The individual being evaluated.
Returns:
A double representing the value of the constant one.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateDouble in class Terminal

instance

public final Primitive instance()
Creates an instance of this One object. The Type instantiation is preserved so that if an INT One is being cloned, the clone will also be INT instantiated.
Returns:
A reference to this Object (yes the same object, since the type information is to be the same, there are therefore no instance variables to be modified.
Overrides:
instance in class Primitive

toString

public java.lang.String toString()
Returns a String representation of this Terminal.
Returns:
A String containing the name of the Terminal.
Overrides:
toString in class Primitive