|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.groovyj.jgprog.Function
The base class of all terminals and functions. A generic Function consists of zero or more children Functions and a return type. If a Function has zero children then it is a terminal. If a Function has more than zero children then it is a function.
Copyright (c) 2000 Robert Baruch. This code is released under the GNU General Public License (GPL).
| Field Summary | |
protected int |
arity
|
protected static Individual |
individual
The individual currently being evaluated. |
protected Type |
returnType
The return type of this node. |
| Constructor Summary | |
protected |
Function(int arity,
Type type)
Create a node with the given arity (i.e. |
| Method Summary | |
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. |
void |
execute_void(Chromosome c,
int n)
Executes this node, returning nothing. |
java.lang.Object |
execute(Chromosome c,
int n)
Executes this node without knowing its return type. |
int |
getArity()
Gets the arity (or number of children) of this node. |
abstract Type |
getChildType(int i)
Gets the type of node allowed form the given child number. |
abstract java.lang.String |
getName()
Gets the name of this node. |
Type |
getReturnType()
Gets the return type of this node |
static void |
setIndividual(Individual individual)
Sets the individual currently being evaluated. |
void |
setReturnType(Type type)
Sets the return type of this node |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected Type returnType
protected int arity
protected static transient Individual individual
World when it evaluates an individual.| Constructor Detail |
protected Function(int arity,
Type type)
arity - the number of childrentype - the return type for this node| Method Detail |
public static void setIndividual(Individual individual)
individual - the individual currently being evaluatedpublic int getArity()
public Type getReturnType()
public void setReturnType(Type type)
type - the type to set the return type to
public boolean execute_boolean(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not boolean
public void execute_void(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not void
public int execute_int(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not integer
public long execute_long(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not long
public float execute_float(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not float
public double execute_double(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not double
public java.lang.Object execute_object(Chromosome c,
int n)
UnsupportedOperationException - if the type of this node is not object
public java.lang.Object execute(Chromosome c,
int n)
public abstract java.lang.String getName()
public abstract Type getChildType(int i)
i - the child number
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||