|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcodesimian.CS<CSGeneric>
codesimian.DefaultCS
codesimian.JavaFunctionSimple
public class JavaFunctionSimple
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: JavaFunctionSimple.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.
JavaFunctionSimple: 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 JavaFunctionSimple.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, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS |
| Constructor Summary | |
|---|---|
JavaFunctionSimple()
default constructor used for testing, uses Method CS.countP() |
|
JavaFunctionSimple(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()
Execute this CS and cast to double. |
static java.lang.reflect.Method |
findMethod(java.lang.Class c,
java.lang.String methodName,
java.lang.Class[] parameterTypes)
|
static java.lang.reflect.Method |
findMethod(java.lang.String methodPackageClassAndName)
|
java.lang.Object |
getObject()
Deprecated. |
static boolean |
isNumberType(java.lang.Class c)
any primitive except void or boolean |
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 |
LForProxy(java.lang.Class castTo)
the default implementation can use many Class parameters. |
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, javaCode, 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, setPType, setS, setZ, start, toString, V, Z |
| Methods inherited from class codesimian.CS |
|---|
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, JForProxy, L, 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, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, VForProxy, voidReflect, ZForProxy |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JavaFunctionSimple()
public JavaFunctionSimple(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 methodPackageClassAndName)
public static java.lang.reflect.Method findMethod(java.lang.Class c,
java.lang.String methodName,
java.lang.Class[] parameterTypes)
throws JavaReflectException
JavaReflectExceptionpublic 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 DefaultCSanyObject@Deprecated public 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 LForProxy(java.lang.Class castTo)
throws java.lang.ClassCastException
DefaultCS
LForProxy in class DefaultCSjava.lang.ClassCastExceptionexecProxy(),
setExecProxy(CS)public static boolean isNumberType(java.lang.Class c)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||