gpsys.primitives
Class Zero

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

public class Zero
extends Terminal

	<typeX> Zero
 
Zero is a generic Terminal which which represents the constant value zero. Zero 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
Zero(Type type)
          Constructs a constant of value zero for the specified type.
 
Method Summary
 byte evaluateByte(Individual i)
          Used to get a BYTE value of the constant zero.
 double evaluateDouble(Individual i)
          Used to get a DOUBLE value of the constant zero.
 float evaluateFloat(Individual i)
          Used to get a FLOAT value of the constant zero.
 int evaluateInt(Individual i)
          Used to get a INT value of the constant zero.
 long evaluateLong(Individual i)
          Used to get a LONG value of the constant zero.
 short evaluateShort(Individual i)
          Used to get a SHORT value of the constant zero.
 Primitive instance()
          Creates an instance of this Zero 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

Zero

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

evaluateByte

public final byte evaluateByte(Individual i)
                        throws EvaluationException
Used to get a BYTE value of the constant zero.
Parameters:
i - The individual being evaluated.
Returns:
A byte representing the value of the constant zero.
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 zero.
Parameters:
i - The individual being evaluated.
Returns:
A short representing the value of the constant zero.
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 zero.
Parameters:
i - The individual being evaluated.
Returns:
An int representing the value of the constant zero.
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 zero.
Parameters:
i - The individual being evaluated.
Returns:
A long representing the value of the constant zero.
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 zero.
Parameters:
i - The individual being evaluated.
Returns:
A float representing the value of the constant zero.
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 zero.
Parameters:
i - The individual being evaluated.
Returns:
A double representing the value of the constant zero.
Throws:
EvaluationException - If there is an evaluation failure.
Overrides:
evaluateDouble in class Terminal

instance

public final Primitive instance()
Creates an instance of this Zero object. The Type instantiation is preserved so that if an INT Zero 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