|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gap.GPFunction
This class represents a function in a program tree.
Field Summary | |
GPFunction[] |
arg
Arguments of the function |
Ref |
father
Reference to the father. |
int |
idx
Index in the function set; set by GPProgram. |
static int |
NO_TYPE
No information on the type. |
static int |
SPECIAL
Special type: type information has to be found elsewhere. |
Constructor Summary | |
GPFunction()
|
Method Summary | |
void |
compile(jrgp.bytecoder0.Bytecoder coder,
CompileContext ctxt)
Do not try (to implement) this at home. |
GPFunction |
deepClone(GPProgram p,
Ref father)
Clone the function and all his arguments. |
abstract float |
exec(java.lang.Object o,
float[] args)
Execute the function with reference to an object and an array of arguments. |
int[] |
getCompatibility(int arg_no)
Grammatical rules. |
int |
getNArgs()
Return the number of arguments. |
java.lang.String |
getObjArgTypeName()
Return the name of the object passed to the exec method. |
int |
getType()
Return the type of the function, for grammatical purposes. |
java.lang.String |
prettyPrint(java.lang.String ident)
Return a string representation of the function and its children. |
java.lang.String |
toString()
Return the name of the function, extracted from the class name. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int idx
public GPFunction[] arg
public Ref father
public static final int NO_TYPE
public static final int SPECIAL
Constructor Detail |
public GPFunction()
Method Detail |
public int getType()
public int[] getCompatibility(int arg_no)
null
if all types accepted.public int getNArgs()
public abstract float exec(java.lang.Object o, float[] args)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String prettyPrint(java.lang.String ident)
public void compile(jrgp.bytecoder0.Bytecoder coder, CompileContext ctxt) throws CompileFailureException
Default behaviour is to throw a CompileFailureException
about missing compile support.
OTOH fs-d produces GPFunctions with the needed compile logic.
public java.lang.String getObjArgTypeName()
exec(java.lang.Object, float[])
public GPFunction deepClone(GPProgram p, Ref father)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |