All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.primitives.If
java.lang.Object
|
+----gpsys.Primitive
|
+----gpsys.Function
|
+----gpsys.primitives.If
- public class If
- extends Function
<TypeX> if (BOOLEAN condition, <typeX> trueValue, <typeX> falseValue)
If is a generic function that conditionally evaluates one of two arguments.
The function evaluates the first argument (which is of Type BOOLEAN). If the
result is true, then the result of evaluating the second argument is
returned, otherwise the result of evaluating the third argument is
returned. The second and third arguments must be of the same type.
If needs to be Type instantiated during construction to work with particular
argument Types. The supported argument
Types include 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
-
If(Type)
- Constructs an If Function that works with the specified Type.
-
evaluateBoolean(Individual, Gene[])
- Used to conditionally evaluate arguments of BOOLEAN Types.
-
evaluateByte(Individual, Gene[])
- Used to conditionally evaluate arguments of BYTE Types.
-
evaluateChar(Individual, Gene[])
- Used to conditionally evaluate arguments of CHAR Types.
-
evaluateDouble(Individual, Gene[])
- Used to conditionally evaluate arguments of DOUBLE Types.
-
evaluateFloat(Individual, Gene[])
- Used to conditionally evaluate arguments of FLOAT Types.
-
evaluateInt(Individual, Gene[])
- Used to conditionally evaluate arguments of INT Types.
-
evaluateLong(Individual, Gene[])
- Used to conditionally evaluate arguments of LONG Types.
-
evaluateObject(Individual, Gene[])
- Used to conditionally evaluate arguments of OBJECT Types.
-
evaluateShort(Individual, Gene[])
- Used to conditionally evaluate arguments of SHORT Types.
-
instance()
- Creates an If Object of the same type.
-
toString()
- Returns a String representation of this Function.
If
public If(Type returnType)
- Constructs an If Function that works with the specified Type. The
supported Types include BYTE, SHORT, INT, LONG, FLOAT, DOUBLE, CHAR,
BOOLEAN, and OBJECT.
- Parameters:
- type - The Type of this If Function.
evaluateObject
public final Object evaluateObject(Individual i,
Gene arguments[]) throws EvaluationException
- Used to conditionally evaluate arguments of OBJECT Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- An Object reference representing the result of the evaluation.
- 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 conditionally evaluate arguments of BYTE Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A byte representing the result of the evaluation.
- 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 conditionally evaluate arguments of SHORT Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A short representing the result of the evaluation.
- 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 conditionally evaluate arguments of INT Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- An int representing the result of the evaluation.
- 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 conditionally evaluate arguments of LONG Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A long representing the result of the evaluation.
- 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 conditionally evaluate arguments of FLOAT Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A float representing the result of the evaluation.
- 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 conditionally evaluate arguments of DOUBLE Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A double representing the result of the evaluation.
- 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 conditionally evaluate arguments of CHAR Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A char representing the result of the evaluation.
- 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 conditionally evaluate arguments of BOOLEAN Types.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees representing the arguments to be
conditionally evaluated.
- Returns:
- A boolean representing the result of the evaluation.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateBoolean in class Function
instance
public final Primitive instance()
- Creates an If Object of the same type.
- Returns:
- A reference to the same Object since no instance varaibles need
to be changed.
- 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