All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.primitives.ProgN
java.lang.Object
|
+----gpsys.Primitive
|
+----gpsys.Function
|
+----gpsys.primitives.ProgN
- public class ProgN
- extends Function
<typeX> ProgN(<typeX> a1, <typeX> a2, ..., <typeX> aN)
ProgN is a generic function that takes N arguments of the same type,
evaluates all of them, and returns the value of the last argument. Supported
Types include OBJECT, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, CHAR and
BOOLEAN.
- 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, Function
-
ProgN(Type, int)
- Constructs a new ProgN Function which takes the specified number of
arguments, all of which are of the specified type.
-
evaluateBoolean(Individual, Gene[])
- Used to evaluate a ProgN Function of Type BOOLEAN.
-
evaluateByte(Individual, Gene[])
- Used to evaluate a ProgN Function of Type BYTE.
-
evaluateChar(Individual, Gene[])
- Used to evaluate a ProgN Function of Type CHAR.
-
evaluateDouble(Individual, Gene[])
- Used to evaluate a ProgN Function of Type DOUBLE.
-
evaluateFloat(Individual, Gene[])
- Used to evaluate a ProgN Function of Type FLOAT.
-
evaluateInt(Individual, Gene[])
- Used to evaluate a ProgN Function of Type INT.
-
evaluateLong(Individual, Gene[])
- Used to evaluate a ProgN Function of Type LONG.
-
evaluateObject(Individual, Gene[])
- Used to evaluate a ProgN Function of Type OBJECT.
-
evaluateShort(Individual, Gene[])
- Used to evaluate a ProgN Function of Type SHORT.
-
instance()
- Creates an instance of this ProgN object.
-
toString()
- Returns a String representation of this Function.
ProgN
public ProgN(Type returnType,
int argNum)
- Constructs a new ProgN Function which takes the specified number of
arguments, all of which are of the specified type.
- Parameters:
- returnType - The type of all the arguments. This must be one
one of OBJECT, BYTE, SHORT, INT, LONG, FLOAT,
DOUBLE, CHAR or BOOLEAN.
- argNum - The number of arguments taken by the Function.
evaluateObject
public final Object evaluateObject(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type OBJECT.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- An Object reference, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateObject in class Function
evaluateByte
public final byte evaluateByte(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type BYTE.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A byte, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateByte in class Function
evaluateShort
public final short evaluateShort(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type SHORT.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A short, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateShort in class Function
evaluateInt
public final int evaluateInt(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type INT.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- An int, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateInt in class Function
evaluateLong
public final long evaluateLong(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type LONG.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A long, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateLong in class Function
evaluateFloat
public final float evaluateFloat(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type FLOAT.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A float, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateFloat in class Function
evaluateDouble
public final double evaluateDouble(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type DOUBLE.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A double, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateDouble in class Function
evaluateChar
public final char evaluateChar(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type CHAR.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A char, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateChar in class Function
evaluateBoolean
public final boolean evaluateBoolean(Individual i,
Gene arguments[]) throws EvaluationException
- Used to evaluate a ProgN Function of Type BOOLEAN.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
evaluated.
- Returns:
- A boolean, which is the value of the last argument.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateBoolean in class Function
instance
public final Primitive instance()
- Creates an instance of this ProgN object. The Type instantiation is
preserved so that if an INT ProgN is being cloned, the clone will also be
INT instantiated. So to is the number of arguments to expected (the
value of N).
- Returns:
- A reference to this Object (yes the same object, since
the type and argument 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 Function.
- Returns:
- A String containing the name of the Function.
- Overrides:
- toString in class Primitive
All Packages Class Hierarchy This Package Previous Next Index