|
|||||||||
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.Divide
The protected divide function. Allowed to be of type int, long, float, or double. Its first child is the numerator and its second child is the denominator. Both children must be of the same type as this node. If the denominator is zero, the node returns 1.
Copyright (c) 2000 Robert Baruch. This code is released under the GNU General Public License (GPL).
Inner Class Summary | |
static interface |
Divide.Compatible
|
Fields inherited from class com.groovyj.jgprog.Function |
arity, individual, returnType |
Constructor Summary | |
Divide(Type type)
Creates a divide node of the given type |
Method Summary | |
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. |
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. |
Methods inherited from class com.groovyj.jgprog.Function |
execute_boolean, 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 |
Constructor Detail |
public Divide(Type type)
type
- the type of the nodeMethod Detail |
public java.lang.String getName()
Function
getName
in class Function
com.groovyj.jgprog.Function
public int execute_int(Chromosome c, int n)
Function
execute_int
in class Function
com.groovyj.jgprog.Function
UnsupportedOperationException
- if the type of this node is not integerpublic long execute_long(Chromosome c, int n)
Function
execute_long
in class Function
com.groovyj.jgprog.Function
UnsupportedOperationException
- if the type of this node is not longpublic float execute_float(Chromosome c, int n)
Function
execute_float
in class Function
com.groovyj.jgprog.Function
UnsupportedOperationException
- if the type of this node is not floatpublic double execute_double(Chromosome c, int n)
Function
execute_double
in class Function
com.groovyj.jgprog.Function
UnsupportedOperationException
- if the type of this node is not doublepublic java.lang.Object execute_object(Chromosome c, int n)
Function
execute_object
in class Function
com.groovyj.jgprog.Function
UnsupportedOperationException
- if the type of this node is not objectpublic Type getChildType(int i)
Function
getChildType
in class Function
com.groovyj.jgprog.Function
i
- the child number
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |