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

Constructor Index

 o ProgN(Type, int)
Constructs a new ProgN Function which takes the specified number of arguments, all of which are of the specified type.

Method Index

 o evaluateBoolean(Individual, Gene[])
Used to evaluate a ProgN Function of Type BOOLEAN.
 o evaluateByte(Individual, Gene[])
Used to evaluate a ProgN Function of Type BYTE.
 o evaluateChar(Individual, Gene[])
Used to evaluate a ProgN Function of Type CHAR.
 o evaluateDouble(Individual, Gene[])
Used to evaluate a ProgN Function of Type DOUBLE.
 o evaluateFloat(Individual, Gene[])
Used to evaluate a ProgN Function of Type FLOAT.
 o evaluateInt(Individual, Gene[])
Used to evaluate a ProgN Function of Type INT.
 o evaluateLong(Individual, Gene[])
Used to evaluate a ProgN Function of Type LONG.
 o evaluateObject(Individual, Gene[])
Used to evaluate a ProgN Function of Type OBJECT.
 o evaluateShort(Individual, Gene[])
Used to evaluate a ProgN Function of Type SHORT.
 o instance()
Creates an instance of this ProgN object.
 o toString()
Returns a String representation of this Function.

Constructors

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

Methods

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