All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.primitives.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.

Author:
Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
See Also:
Type, Primitive, Terminal

Constructor Index

 o One(Type)
Constructs a constant of value one for the specified type.

Method Index

 o evaluateByte(Individual)
Used to get a BYTE value of the constant one.
 o evaluateDouble(Individual)
Used to get a DOUBLE value of the constant one.
 o evaluateFloat(Individual)
Used to get a FLOAT value of the constant one.
 o evaluateInt(Individual)
Used to get a INT value of the constant one.
 o evaluateLong(Individual)
Used to get a LONG value of the constant one.
 o evaluateShort(Individual)
Used to get a SHORT value of the constant one.
 o instance()
Creates an instance of this One object.
 o toString()
Returns a String representation of this Terminal.

Constructors

 o 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.

Methods

 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o toString
 public String toString()
Returns a String representation of this Terminal.

Returns:
A String containing the name of the Terminal.
Overrides:
toString in class Primitive

All Packages  Class Hierarchy  This Package  Previous  Next  Index