All Packages Class Hierarchy This Package Previous Next Index
Class gpsys.primitives.MemGet
java.lang.Object
|
+----gpsys.Primitive
|
+----gpsys.Function
|
+----gpsys.primitives.MemGet
- public class MemGet
- extends Function
<typeX> MemGet(MEM_typeX memory, INT index)
MemGet is a generic Function which takes two arguments. The first is an
indexed memory. The second is an index into that memory. The Function
retrieves the value at the specified location of the specified memory.
MemGet needs to be instantiated to work with a particular type of memory.
Valid memory types include MEM_OBJECT, MEM_BYTE, MEM_SHORT, MEM_INT,
MEM_LONG, MEM_FLOAT, MEM_DOUBLE, MEM_CHAR, and MEM_BOOLEAN.
- Author:
- Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.
- See Also:
- Type, Primitive, Terminal, MemSet
-
MemGet(Type, Type)
- Construct a new MemGet Function to access the specified memory type,
which holds the specified type of elements.
-
evaluateBoolean(Individual, Gene[])
- Used to get values from memory of MEM_BOOLEAN type.
-
evaluateByte(Individual, Gene[])
- Used to get values from memory of MEM_BYTE type.
-
evaluateChar(Individual, Gene[])
- Used to get values from memory of MEM_CHAR type.
-
evaluateDouble(Individual, Gene[])
- Used to get values from memory of MEM_DOUBLE type.
-
evaluateFloat(Individual, Gene[])
- Used to get values from memory of MEM_FLOAT type.
-
evaluateInt(Individual, Gene[])
- Used to get values from memory of MEM_INT type.
-
evaluateLong(Individual, Gene[])
- Used to get values from memory of MEM_LONG type.
-
evaluateObject(Individual, Gene[])
- Used to get values from memory of MEM_OBJECT type.
-
evaluateShort(Individual, Gene[])
- Used to get values from memory of MEM_SHORT type.
-
instance()
- Creates an instance of this MemGet object.
-
toString()
- Returns a String representation of this Function.
MemGet
public MemGet(Type memoryType,
Type returnType)
- Construct a new MemGet Function to access the specified memory type,
which holds the specified type of elements.
- Parameters:
- memoryType - The type of the memory, can be one of MEM_OBJECT,
MEM_BYTE, MEM_SHORT, MEM_INT,MEM_LONG, MEM_FLOAT,
MEM_DOUBLE, MEM_CHAR, and MEM_BOOLEAN.
- returnType - The type that the memory holds, can be one of
OBJECT, BYTE, SHORT, INT, LONG, FLOAT, DOUBLE,
CHAR, and BOOLEAN.
evaluateObject
public final Object evaluateObject(Individual i,
Gene arguments[]) throws EvaluationException
- Used to get values from memory of MEM_OBJECT type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- An Object reference representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_BYTE type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A byte representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_SHORT type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A byte representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_INT type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- An int representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_LONG type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A long representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_FLOAT type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A float representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_DOUBLE type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A double representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_CHAR type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A char representing the value of the memory at the
specified location.
- 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 get values from memory of MEM_BOOLEAN type.
- Parameters:
- i - The individual being evaluated.
- arguments - The Gene trees supplied as arguments to the Function,
the first argument is the memory to be accessed, and
the second argument is the index of the memory location
being accessed.
- Returns:
- A boolean representing the value of the memory at the
specified location.
- Throws: EvaluationException
- If there is an evaluation failure.
- Overrides:
- evaluateBoolean in class Function
instance
public final Primitive instance()
- Creates an instance of this MemGet object. The Type instantiation is
preserved so that if an MEM_INT MemGet is being cloned, the clone will
also be MEM_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 Function.
- Returns:
- A String containing the name of the Function.
- Overrides:
- toString in class Primitive
All Packages Class Hierarchy This Package Previous Next Index