|
|||||||||
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 nodeMethod 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 topublic boolean execute_boolean(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not booleanpublic void execute_void(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not voidpublic int execute_int(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not integerpublic long execute_long(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not longpublic float execute_float(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not floatpublic double execute_double(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not doublepublic java.lang.Object execute_object(Chromosome c, int n)
UnsupportedOperationException
- if the type of this node is not objectpublic 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 |