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.
- Version:
- 1.1, 30th June '97
- Author:
- Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
- See Also:
- Type, Primitive, Terminal
-
One(Type)
- Constructs a constant of value one for the specified type.
-
evaluateByte(Individual)
- Used to get a BYTE value of the constant one.
-
evaluateDouble(Individual)
- Used to get a DOUBLE value of the constant one.
-
evaluateFloat(Individual)
- Used to get a FLOAT value of the constant one.
-
evaluateInt(Individual)
- Used to get a INT value of the constant one.
-
evaluateLong(Individual)
- Used to get a LONG value of the constant one.
-
evaluateShort(Individual)
- Used to get a SHORT value of the constant one.
-
instance()
- Creates an instance of this One object.
-
toString()
- Returns a String representation of this Terminal.
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.
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 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