|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.groovyj.jgprog.Function
|
+--com.groovyj.jgprog.functions.Variable
A node representing a named variable. Allowed to be of type boolean, int, long, float, or double.
A named variable is created by constructing an instance of the Variable, giving
it a name and type. From that point on, all references to that particular variable
should be through either the instance initially created, or looked up via the
getVariable method.
Copyright (c) 2000 Robert Baruch. This code is released under the GNU General Public License (GPL).
| Field Summary | |
java.lang.Object |
value
|
| Fields inherited from class com.groovyj.jgprog.Function |
arity, individual, returnType |
| Method Summary | |
static Variable |
create(java.lang.String name,
Type type)
Creates an instance of a Variable. |
boolean |
execute_boolean(Chromosome c,
int n)
Executes this node as a boolean. |
double |
execute_double(Chromosome c,
int n)
Executes this node as a double. |
float |
execute_float(Chromosome c,
int n)
Executes this node as a float. |
int |
execute_int(Chromosome c,
int n)
Executes this node as an integer. |
long |
execute_long(Chromosome c,
int n)
Executes this node as a long. |
java.lang.Object |
execute_object(Chromosome c,
int n)
Executes this node as an object. |
java.lang.Object |
get()
Gets the value of this named variable. |
static java.lang.Object |
get(java.lang.String name)
Gets the value of a named variable without having to obtain a reference to the named variable. |
Type |
getChildType(int i)
Gets the type of node allowed form the given child number. |
java.lang.String |
getName()
Gets the name of this node. |
static Variable |
getVariable(java.lang.String name)
Gets the one instance of a named variable. |
boolean |
isConstant()
|
void |
set(java.lang.Object value)
Sets the value of this named variable. |
static void |
set(java.lang.String name,
java.lang.Object value)
Sets a named variable without having to obtain a reference to the named variable. |
| Methods inherited from class com.groovyj.jgprog.Function |
execute_void, execute, getArity, getReturnType, setIndividual, setReturnType |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public java.lang.Object value
| Method Detail |
public static Variable create(java.lang.String name,
Type type)
get or
getVariable.name - the name of the Variable to createtype - the type of the Variable to create
public static void set(java.lang.String name,
java.lang.Object value)
name - the name of the variable to setvalue - the value to set the variable withpublic static java.lang.Object get(java.lang.String name)
name - the name of the variable to getpublic static Variable getVariable(java.lang.String name)
name - the name of the variable to getpublic void set(java.lang.Object value)
value - the value to set this variable withpublic java.lang.Object get()
public java.lang.String getName()
FunctiongetName in class Functioncom.groovyj.jgprog.Function
public boolean execute_boolean(Chromosome c,
int n)
Functionexecute_boolean in class Functioncom.groovyj.jgprog.FunctionUnsupportedOperationException - if the type of this node is not boolean
public int execute_int(Chromosome c,
int n)
Functionexecute_int in class Functioncom.groovyj.jgprog.FunctionUnsupportedOperationException - if the type of this node is not integer
public long execute_long(Chromosome c,
int n)
Functionexecute_long in class Functioncom.groovyj.jgprog.FunctionUnsupportedOperationException - if the type of this node is not long
public float execute_float(Chromosome c,
int n)
Functionexecute_float in class Functioncom.groovyj.jgprog.FunctionUnsupportedOperationException - if the type of this node is not float
public double execute_double(Chromosome c,
int n)
Functionexecute_double in class Functioncom.groovyj.jgprog.FunctionUnsupportedOperationException - if the type of this node is not double
public java.lang.Object execute_object(Chromosome c,
int n)
Functionexecute_object in class Functioncom.groovyj.jgprog.FunctionUnsupportedOperationException - if the type of this node is not objectpublic Type getChildType(int i)
FunctiongetChildType in class Functioncom.groovyj.jgprog.Functioni - the child numberpublic boolean isConstant()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||