|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcodesimian.CS
codesimian.DefaultCS
codesimian.JavaMethod2
public class JavaMethod2
Wrapper-class for a java.lang.reflect.Method, a dynamicly-called Java function.
A Method can be found for any public Java function, and sometimes for protected functions.
Example: JavaMethod2.class.getMethods().
Param0 is always the returned value.
Param1 is always the instance object to call the Method from.
Param2 and above are the Method parameters.
All CS params are CS.L(Class) to Java Objects or primitive-wrappers like java.lang.Boolean.
JavaMethod2: param0 and param1 are required, even if Method does not use them.
JavaMethod: param0 and param1 are usually optional,
which confuses PType(int) as countP() changes.
WARNING: function overriding in subclasses does not work correctly.
For example, method#codesimian.CS.javaCode(0 +(3 4 5) list) uses CS.javaCode(CS) instead of Add.javaCode(CS).
SOLUTION: Change this class to update the java.lang.Method object
by the class of JavaMethod2.P(1), the instance object.
Then for some reason it stopped having that error. ????????????
| Field Summary |
|---|
| Fields inherited from class codesimian.CS |
|---|
DESCRIPTION, END, EXECPROXY, FUEL, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER |
| Constructor Summary | |
|---|---|
JavaMethod2()
default constructor used for testing, uses Method CS.countP() |
|
JavaMethod2(java.lang.reflect.Method m)
|
|
| Method Summary | |
|---|---|
java.lang.String |
description()
a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for. |
double |
DForProxy()
D() and DForProxy() are the 2 most important functions in CS. |
static java.lang.reflect.Method |
findMethod(java.lang.String methodName)
|
java.lang.Object |
getObject()
Returns the main Object that this CS wraps. |
static boolean |
isNumberType(java.lang.Class c)
any primitive except void or boolean |
java.lang.String |
javaCode(CS listOfCodeAlreadyTraversed)
this function could use a better algorithm, but for now try to get javaCode(CS) to work at all. |
java.lang.String |
keyword()
For the CodeSimian language as a String. CodeSimian language keyword, like "+" "*" "max" ">" etc. Override this function if you want to specify a keyword other than how I derive them from the class name, like + for Add. Some CSs might never be intended to be used in the language by their keyword. The best example (4/05) is Num, because it is used in the language like "3.4" instead of "num()". |
java.lang.Object |
L(java.lang.Class castTo)
Optionally execute this CS, and definitely try to CAST it to the specified Java type. |
int |
minP()
For DForProxy(). Minimum number of parameters in param[] needed to call DForProxy(). Defines which indexs of param[] DForProxy() can use. Functions with a different number of parameters must override this. OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS. Default is 1. |
CS |
PType(int indexP)
There is a TYPE for each Param. A TYPE is a CS whose minP() is at least 1. |
boolean |
setName(java.lang.String newName)
if the new name is a valid Method name (with Java package), like "java.lang.Object.equals". |
boolean |
setObject(java.lang.Object theMethod)
Sets the main Object that this CS wraps. |
| Methods inherited from class codesimian.DefaultCS |
|---|
B, C, countP, decrementMyFuel, deleteP, F, fuel, getExec, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, LForProxy, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setP, setPrevExec, setS, setZ, start, toString, V, Z |
| Methods inherited from class codesimian.CS |
|---|
addP, addP, addP, addP, addP, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, IForProxy, isIllusion, javaCode, JForProxy, L, L, L, L, maxD, maxP, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, setB, setC, setCost, setDescription, setF, setHeap, setI, setJ, setL, setL, setParent, setParsePriority, setProxyOf, setPType, setS, setTester, setZ, SForProxy, tester, VForProxy, voidReflect, ZForProxy |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JavaMethod2()
public JavaMethod2(java.lang.reflect.Method m)
| Method Detail |
|---|
public double DForProxy()
CS
DForProxy in class DefaultCSpublic boolean setName(java.lang.String newName)
setName in class DefaultCSpublic static java.lang.reflect.Method findMethod(java.lang.String methodName)
public java.lang.String keyword()
DefaultCS
keyword in class DefaultCSCS.parent(),
CS.newInstance(),
CS.name()public java.lang.String description()
CS
description in class DefaultCSpublic boolean setObject(java.lang.Object theMethod)
CS
setObject in class DefaultCSanyObjectpublic java.lang.Object getObject()
CS
getObject in class DefaultCSanyObjectpublic int minP()
DefaultCS
minP in class DefaultCSpublic CS PType(int indexP)
CS
PType in class DefaultCS
public java.lang.Object L(java.lang.Class castTo)
throws java.lang.ClassCastException
CS
L in class CSjava.lang.ClassCastExceptionCS.Z(),
CS.B(),
CS.C(),
CS.S(),
CS.I(),
CS.J(),
CS.F(),
CS.D()public java.lang.String javaCode(CS listOfCodeAlreadyTraversed)
javaCode in class DefaultCSpublic static boolean isNumberType(java.lang.Class c)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||