All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.primitives.MemSet

java.lang.Object
   |
   +----gpsys.Primitive
           |
           +----gpsys.Function
                   |
                   +----gpsys.primitives.MemSet

public class MemSet
extends Function
	<typeX> MemSet(MEM_typeX memory, INT index, <typeX> value)
 
MemSet is a generic Function which takes three arguments. The first is an indexed memory. The second is an index into that memory. The third is the value that the specified location of the specified memory needs to be set. 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.

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, MemGet

Constructor Index

 o MemSet(Type, Type)
Construct a new MemSet Function to assign values to the specified memory type, which holds the specified type of elements.

Method Index

 o evaluateBoolean(Individual, Gene[])
Used to set values in memories of MEM_BOOLEAN type.
 o evaluateByte(Individual, Gene[])
Used to set values in memories of MEM_BYTE type.
 o evaluateChar(Individual, Gene[])
Used to set values in memories of MEM_CHAR type.
 o evaluateDouble(Individual, Gene[])
Used to set values in memories of MEM_DOUBLE type.
 o evaluateFloat(Individual, Gene[])
Used to set values in memories of MEM_FLOAT type.
 o evaluateInt(Individual, Gene[])
Used to set values in memories of MEM_INT type.
 o evaluateLong(Individual, Gene[])
Used to set values in memories of MEM_LONG type.
 o evaluateObject(Individual, Gene[])
Used to set values in memories of MEM_OBJECT type.
 o evaluateShort(Individual, Gene[])
Used to set values in memories of MEM_SHORT type.
 o instance()
Creates an instance of this MemSet object.
 o toString()
Returns a String representation of this Function.

Constructors

 o MemSet
 public MemSet(Type memoryType,
               Type returnType)
Construct a new MemSet Function to assign values to 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.

Methods

 o evaluateObject
 public final Object evaluateObject(Individual i,
                                    Gene arguments[]) throws EvaluationException
Used to set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
An Object reference representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A byte representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A short representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
An int representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A long representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A float representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A double representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A char representing the new value of the memory at the specified location.
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 set values in memories 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 written to, the second argument is the index of the memory location to be assigned, and third is the value to be assigned.
Returns:
A boolean representing the new value of the memory at the specified location.
Throws: EvaluationException
If there is an evaluation failure.
Overrides:
evaluateBoolean in class Function
 o instance
 public final Primitive instance()
Creates an instance of this MemSet object. The Type instantiation is preserved so that if an MEM_INT MemSet 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
 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