|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodesimian.CS<CSGeneric>
public abstract class CS<CSGeneric>
CS is the root of all other classes! Its the top of the CodeSimian heirarchy.
Most of what you need to know to add new Java code To CodeSimian is in this file.
Using class JavaOutSimple, which uses class GetJavaCompiler,
some parts of CodeSimian code (created at runtime)
can be converted to Strings of Java code for a subclass of CS.java.
The generated classes go into package codesimian.javaout.
The existing subclasses of CS (in many combinations)
generate new unique and useful subclasses of CS,
and theoretically (or should I say theoryly) those subclasses will
build even smarter subclasses... or at least efficient replacements
for common combinations of codesimian code,
and should search for and replace those codes with the new class at runtime.
This changes the shape of the network (a group of nodes becomes 1 node) therefore it changes
the behavior of code that depends on the shape (instead of the return value) of other code.
For a large code, converting it to a new java class could speed it up 10 times or more.
/ * Free, Open-Source: GNU General Public License 2+ (GPL) ** \
LEGAL: U agree to GPL if U modify or distribute CodeSimian
GPL version 2 or higher (your choice) in file doc/license.txt
NO WARRANTY! Use this self-modifying-software AT OWN RISK
CodeSimian is RECURSIVELY **FREE** to use modify & distribute
and is Copyright 2006 and 2007, Benjamin F Rayfield
Websites: www.codesimian.com codesimian.sourceforge.net
\ ******************************************************* /
All functions in CS are public and some are also abstract. There are no variables, only functions.
Each CS is a list of other CSs, and each subclass of CS uses the contents of the list differently.
List size, countP(), must be between minP() and maxP() when the CS is EXECUTED.
All functions whose names contain a capital P (except "Proxy" and "Parent")
are about PARAMS (CSs inside this CS). Examples: P(int), PD(), setP(int,CS).
Params are the contents of the list: Each CS is a list of other CSs.
Each CS has 1 main action: EXECUTE this CS.
All of these functions can EXECUTE a CS: V() L(Class) L(int,Class,int) Z() B() C() S() I() J() F() and D().
Each does approximately the same thing, but with a different return-type.
All types of primitive and array can be returned, and many object types.
Different CSs can return different object types, many types per CS.
CS objects should try to use other CS objects only as type CS instead of their runtime-type,
to avoid tangling CodeSimian with hard-code.
Example: CS mult = new Multiply(); instead of: Multiply mult = new Multiply();
That allows me to later write: mult = new AntiDivide(); //AntiDivide does not extend Multiply
In codesimian code, 2 times (3 plus 4 plus 5) times 6 is written as: *(2 +(3 4 5) 6)
Any type-specific functions you need to call can be called dynamicly with a JavaFunctionSimple.
Functions whose names start with "set" return boolean.
Most of them are allowed to ALWAYS RETURN FALSE,
which would mean that feature is not available in the CS it is called from,
but may be available in other CSs.
A TYPE is any primitive, Object, primitive[] array,
Object[] array, or a CS containing any of those.
In addition to that, CodeSimian uses a more advanced idea of TYPE:
A TYPE is a CS whose maxP() is at least 1.
A TYPE measures its 1 parameter (the CS returned by theType.P(0)),
and returns a more positive number if the parameter is more like that type,
or 0 or less if it is not that type. Of course, the more negative, the less like that type it is.
A TYPE is like an anonymous fitness-function in a genetic-algorithm.
Some functions (that usually do the same thing) come in groups of 10-12,
each for a different TYPE. Example: the EXECUTE functions above.
Example: the PREV functions. Example: the setX functions where X is any EXECUTE function.
WHY SO MANY FUNCTIONS?
These 100+ functions seem confusing, but they are ordered on 3 dimensions+++
+ There are 4 main actions: SET, GET, INSERT, and DELETE.
+ There are 3 main targets: 1 CS in params, multiple adjacent CSs in params, the value of this CS.
+ TYPES. Multiply 3 x 4 x all the TYPES, and you get a 3D block of functions,
where the location tells what the function does.
There is a hole in the cube at INSERT or DELETE x VALUE OF THIS CS.
Some functions like heap() and setHeap(CS) are not included in that cube.
They're simply the GET and SET for variables that a CS should have,
but are not copied for each TYPE. Theres only 1 get and 1 set.
But these functions (like heap() and parsePriority()) are complicating CS.java,
so they should eventually be changed to only be accessed by L("heap") setL("heap",someObject) etc.
Only important functions, like myFuel() and name(), will remain hard-coded into CS.java.
Functions whose name contains a capital L allow Java Object types to be converted to and from CSs.
L functions with 1 or more int parameters allow OPTIMIZATIONS for specific Object types.
Example: if some CS's params are represented as chars in a String (instead of a CS[] array)
then that CS should override L(int i,Class c,int j) to return new S(String.substring(i,i+j)) if c == String.class;
else return super.L(i,c,j); //S is a type of CS that is stored as a String in memory
WHY IS CS A CLASS INSTEAD OF AN INTERFACE?
I would have liked to make CS be an interface instead of an abstract class,
for more flexibility in extending it, but I found that
as a class it is approximately 30% faster than as an interface (in the very limited tests I did).
Thats probably because as a class its functions are in known indexs in the JVM's array of functions,
but as an interface, its functions could be at any index since the CLASS determines position,
and functions must be looked up more DYNAMICLY which is slower.
Not much has been lost: Since this class has approximately 100 functions,
its unlikely anybody would use it as an interface
except by automatic generation of Java code (by JavaOutSimple.java),
and then it would be too hard to rename any function or field name collisions.
Class is faster than interface, but interface is more flexible.
Many functions use this CS as a list of CSs.
The default implementations are lazy and dont always throw IndexOutOfBoundsException's when they should.
TODO: remove the "heap" functions of this class???
Heap used negative indexs. It will still use negative indexs, but only hard-coded indexs like these...
public static final int NULL = -1; public static final int EXECPROXY = -2; public static final int PREV = -3; public static final int FUEL = -4; public static final int MYFUEL = -5; public static final int NAME = -6; public static final int NEWINSTANCE = -7; public static final int PARENT = -8; public static final int DESCRIPTION = -9; public static final int PARSEPRIORITY = -10; public static final int JAVACODE = -11; public static final int HEAP = -12;
Field Summary | |
---|---|
static int |
DESCRIPTION
|
static int |
END
This is the lowest negative index reserved for CS reflection MINUS ONE. |
static int |
EXECPROXY
someCS.P(CS.EXECPROXY) should return someCS.getExec(), and optionally someCS.setP(CS.EXECPROXY,x) (or other SET functions) should call someCS.setExec(x), but if the SET functions dont do that, they should return false in that case. |
static int |
HEAP
|
static int |
JAVACODE
|
static int |
MYFUEL
|
static int |
NAME
|
static int |
NEWINSTANCE
|
static int |
NULL
NULL is returned, for example, by indexP(CS) when the CS cant be found. |
static int |
PARENT
|
static int |
PARSEPRIORITY
|
static int |
PREV
important if myFuel==0, but may be replaced (for all primitives, this is Double) by prevD(double howFarBack) or prevL prevC etc. |
static int |
TESTER
|
static int |
THIS
|
Constructor Summary | |
---|---|
CS()
|
Method Summary | |
---|---|
CS |
addB(byte x)
|
CS |
addC(char x)
|
CS |
addD(double x)
|
CS |
addF(float x)
|
CS |
addI(int x)
|
CS |
addJ(long x)
|
CS |
addL(java.lang.Object add0)
same as setL1(countP(),add0) except returns this if setL1 succeeds else returns throwFromAdd('P') |
CS |
addP(CS param)
Adds a new param at the end of the list. |
CS |
addP(CS add0,
CS add1)
Deprecated. |
CS |
addP(CS add0,
CS add1,
CS add2)
Deprecated. |
CS |
addP(CS add0,
CS add1,
CS add2,
CS add3)
Deprecated. |
CS |
addP(CS add0,
CS add1,
CS add2,
CS add3,
CS add4)
Deprecated. |
CS |
addS(short x)
|
CS |
addZ(boolean x)
|
byte |
B()
|
byte |
BForProxy()
|
char |
C()
|
char |
CForProxy()
|
java.lang.Object |
clone()
returns newInstance(), but if thats null then throws a CloneNotSupportedException This function overrides java.lang.Object.clone(); |
double |
cost()
cost() should be changed to return a float, and should be renamed to costToExecute() cost of EXECUTING this CS, not including any CSs it executes recursively. |
abstract int |
countP()
Quantity of params. |
double |
D()
Execute this CS and cast to double. |
abstract boolean |
decrementMyFuel()
Try to use 1 fuel credit. |
abstract boolean |
deleteP(int index)
Deletes a Param at specified index, and slides the higher params down 1 index. |
boolean |
deleteP(int startIndex,
int quantity)
deletes a range of Params |
abstract java.lang.String |
description()
a short description of this CS, shorter than the javadoc, but long enough to tell what the params are for. |
abstract double |
DForProxy()
Execute this CS and cast to double. |
float |
F()
|
float |
FForProxy()
|
abstract CS |
fuel()
Fuel limits EXECUTION of CSs, to make sure none execute too much more than the others. |
byte |
GETB()
|
char |
GETC()
|
double |
GETD()
|
abstract CS |
getExec()
Every CS must have an EXECPROXY (also called PROXY), even if its a trivial wrapper. |
float |
GETF()
|
int |
GETI()
|
long |
GETJ()
|
java.lang.Object |
GETL(java.lang.Class type)
|
java.lang.Object |
getObject()
Deprecated. |
short |
GETS()
|
boolean |
GETZ()
|
abstract CS |
heap()
HEAP is a place to put CSs that are not directly related to the CS that contains them. |
int |
I()
|
int |
IForProxy()
|
int |
indexP(CS myParam)
Opposite of P(int). Returns the index of the specified param, or -1 if its not a param of this CS. |
int |
indexPName(java.lang.String paramName)
returns the index of the Param with specified Name, or -1 if no Param has that Name. |
boolean |
insertB(int paramIndex,
byte value)
|
boolean |
insertC(int paramIndex,
char value)
|
abstract boolean |
insertD(int paramIndex,
double value)
inserts a double as a param at a specific index. |
boolean |
insertF(int paramIndex,
float value)
|
boolean |
insertI(int paramIndex,
int value)
|
boolean |
insertJ(int paramIndex,
long value)
|
abstract boolean |
insertL(int startIndex,
java.lang.Object insertMe)
Inserts an Object into MULTIPLE param indexs. |
abstract boolean |
insertL(int startIndex,
java.lang.Object insertMe,
int indexQuantity)
Inserts an Object into a specific subset of param indexs. |
abstract boolean |
insertL1(int singleIndex,
java.lang.Object value)
inserts an Object into 1 param index. |
abstract boolean |
insertP(int index,
CS insertMe)
same as setP(int,CS) but inserts instead of overwriting. |
boolean |
insertS(int paramIndex,
short value)
|
boolean |
insertZ(int paramIndex,
boolean value)
|
byte |
isIllusion(int index)
Describes if the CS in an index is an illusion or not. |
long |
J()
Execute this CS and cast to long. Most subclasses should override JForProxy() instead of J(), or neither, which is true for all ?ForProxy vs ? functions. |
long |
JForProxy()
|
abstract java.lang.String |
keyword()
Deprecated. |
java.lang.Object |
L(java.lang.Class castToThisType)
Optionally execute this CS, and definitely try to CAST it to the specified Java type. |
java.lang.Object |
L(int startIndex,
java.lang.Class castToThisType,
int indexQuantity)
same as L(Class) except only uses a subset of param indexs. Like many other L functions, allows converting CSs to specific Object types. Example: new S("abcdefg").L(2,String.class,3) returns "cde". |
java.lang.Object |
L(int startIndex,
java.lang.Object castToThisType,
int indexQuantity)
|
java.lang.Object |
L(java.lang.Object key)
The 3 most common key types are: Class, Integer, and Number. |
java.lang.Object |
L(java.lang.String varName)
Deprecated. replace me with L(Object) and setL(Object,Object) |
abstract java.lang.Object |
LForProxy(java.lang.Class castToThisType)
The "?ForProxy" functions should only be called by a PROXY CS. |
abstract java.lang.Object |
LForProxy(int startIndex,
java.lang.Class castToThisType,
int indexQuantity)
|
double |
maxD()
maximum value D() can ever return (or any of the other primitive EXECUTE functions). |
int |
maxP()
Maximum quantity of Params |
double |
minD()
minimum value D() can ever return (or any of the other primitive EXECUTE functions). |
abstract int |
minP()
Minimum quantity of Params. |
abstract int |
myFuel()
Returns how many times this CS may EXECUTE before it needs to trade some CS fuel for int fuel. |
abstract java.lang.String |
name()
returns the name of this CS. |
abstract CS |
newInstance()
The primary way to instantiate subclasses of CS. |
byte |
overwrites(int index)
Describes when (if ever) this CS overwrites one of its own childs. |
abstract CS |
P(int index)
Returns a CS from this list with specific index. |
CS |
parent()
9/06 parent() is not yet finished. |
int |
parsePriority()
Deprecated. |
byte |
PB(int paramIndex)
|
char |
PC(int paramIndex)
|
double |
PD(int paramIndex)
Returns a param as a double. |
float |
PF(int paramIndex)
|
int |
PI(int paramIndex)
|
long |
PJ(int paramIndex)
|
java.lang.Object |
PL(int paramIndex,
java.lang.Class castParamToThisType)
PL PD PF PJ PI PS PC PB and PZ are only for convenience and optimization. |
byte |
prevB()
|
char |
prevC()
|
abstract double |
prevD()
Returns the value of the last EXECUTION of this CS |
float |
prevF()
|
int |
prevI()
|
long |
prevJ()
|
abstract java.lang.Object |
prevL()
returns the previous execute value as an Object. |
short |
prevS()
|
boolean |
prevZ()
Returns true if the PREVIOUS EXECUTION of this CS was a positive number (or true). |
CS |
proxyOf(java.lang.reflect.Method anyMethodInThisClass)
a proxy for a specific Java Method. |
short |
PS(int paramIndex)
|
abstract CS |
PType(int index)
There is a TYPE for each Param. A TYPE is a CS whose minP() is at least 1. |
boolean |
PZ(int paramIndex)
|
java.lang.Object |
reflect(java.lang.Object[] nameAndParameters)
Calls any function by reflection, including reflective functions on higher levels, reflection of reflection of reflection... |
java.lang.Object |
reflect(java.lang.String name,
java.lang.Object[] parameters)
same as reflect(Object[]) except the array is 1 smaller, and all indexs are 1 lower, and the first element which was taken out is String name, This function is useful because it can use the same array as java.lang.reflect.Method.invoke(Object[]); Name should equal java.lang.reflect.Method.getName() of some Java function (Method). |
CodeSimian |
reflect6(java.lang.Class returnType,
java.lang.Class instanceType,
byte getSetInsertOrDelete,
java.lang.Class locationType,
byte quantityType,
java.lang.Class valueType)
Returns a CS with countP()==6, that reflects almost any possible action in codesimian language. |
short |
S()
|
boolean |
setB(byte setToThisValue)
|
void |
SETB(byte b)
|
boolean |
setB(int paramIndex,
byte value)
|
boolean |
setC(char setToThisValue)
|
void |
SETC(char c)
|
boolean |
setC(int paramIndex,
char value)
|
boolean |
setCost(float cost)
Rename this to setCostToExecute() |
abstract boolean |
setD(double setToThisValue)
|
void |
SETD(double d)
|
abstract boolean |
setD(int paramIndex,
double value)
sets a param to a double value. |
boolean |
setDescription(java.lang.String newDescription)
|
boolean |
setExec(CS newExecProxy)
|
boolean |
setF(float setToThisValue)
|
void |
SETF(float f)
|
boolean |
setF(int paramIndex,
float value)
|
abstract boolean |
setFuel(CS newFuel)
|
boolean |
setHeap(CS newHeap)
|
boolean |
setI(int setToThisValue)
|
void |
SETI(int i)
|
boolean |
setI(int paramIndex,
int value)
|
boolean |
setJ(int paramIndex,
long value)
|
boolean |
setJ(long setToThisValue)
|
void |
SETJ(long j)
|
abstract boolean |
setL(int startIndex,
java.lang.Object setToThisValue)
Overwrites a range of params with some interpretation of the Object. Like setL(int,Object,int) but the Object determines the quantity of indexs. |
abstract boolean |
setL(int startIndex,
java.lang.Object setToThisValue,
int indexQuantity)
like setL(Object) but sets exactly the indexs between startIndex and startIndex+indexQuantity-1 inclusive |
abstract boolean |
setL(java.lang.Object setToThisValue)
setL setD setF setJ setI setS setC setB setZ are functions that SET THE VALUE OF THIS CS to some object, primitive, or array. |
void |
SETL(java.lang.Object l)
|
boolean |
setL(java.lang.Object key,
java.lang.Object value)
Sets the value of something. |
boolean |
setL(java.lang.String varName,
java.lang.Object value)
Deprecated. replace me with L(Object) and setL(Object,Object) |
abstract boolean |
setL1(int singleIndex,
java.lang.Object value)
overwrites 1 param with an Object. |
abstract boolean |
setMyFuel(int newValue)
|
boolean |
setName(java.lang.String newName)
sets the name of this CS |
boolean |
setObject(java.lang.Object setTo)
Deprecated. |
abstract boolean |
setP(int index,
CS setTo)
Every CS is a list of other CSs, between size minP() and maxP() inclusive. |
boolean |
setParent(CS parent)
|
boolean |
setParsePriority(int parsePriority)
|
abstract void |
setPrevExec(double d)
Deprecated. |
boolean |
setProxyOf(java.lang.reflect.Method anyMethodInThisClass,
CS proxy)
sets the proxy of a Method. |
boolean |
setPType(int indexP,
CS newTypeOfThatParam)
Since only a small fraction of CSs use types other than the default type, setPType(int,CS) returns false by default. |
boolean |
setS(int paramIndex,
short value)
|
boolean |
setS(short setToThisValue)
|
void |
SETS(short s)
|
boolean |
setTester(CS tester)
default: false |
boolean |
setZ(boolean setToThisValue)
|
void |
SETZ(boolean z)
|
boolean |
setZ(int paramIndex,
boolean value)
|
short |
SForProxy()
|
CS |
tester()
Returns a CS that can test if this CS works correctly, or null if dont know how to test. |
java.lang.String |
toJavaCode(CSCallOptions options,
JavaCodeWritingState state)
returns the code for a new subclass of CS that does the same thing as this network of code. |
void |
V()
|
void |
VForProxy()
|
void |
voidReflect(java.lang.Object[] returnAndNameAndParameters)
Same as reflect(Object[]) except the array is 1 bigger, and returnAndNameAndParameters[0] is replaced by the return-value of the reflected function being called, and all indexs are 1 higher. |
boolean |
Z()
|
boolean |
ZForProxy()
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NULL
public static final int THIS
public static final int NEWINSTANCE
public static final int NAME
public static final int MYFUEL
public static final int EXECPROXY
public static final int PREV
public static final int JAVACODE
public static final int DESCRIPTION
public static final int HEAP
public static final int PARENT
public static final int TESTER
public static final int PARSEPRIORITY
public static final int END
Constructor Detail |
---|
public CS()
Method Detail |
---|
public abstract CS P(int index)
index
- range 0 (or neg?) to countP()-1 inclusiveheap()
public abstract boolean setP(int index, CS setTo)
public abstract boolean insertP(int index, CS insertMe)
public abstract boolean deleteP(int index)
public boolean deleteP(int startIndex, int quantity)
deleteP
in interface CodeSimian
public abstract int minP()
public abstract int countP()
public int maxP()
public int indexP(CS myParam)
public int indexPName(java.lang.String paramName)
name()
,
setName(String)
,
indexP(CS)
public abstract CS PType(int index)
public boolean setPType(int indexP, CS newTypeOfThatParam)
public CS addP(CS param)
@Deprecated public CS addP(CS add0, CS add1)
@Deprecated public CS addP(CS add0, CS add1, CS add2)
@Deprecated public CS addP(CS add0, CS add1, CS add2, CS add3)
@Deprecated public CS addP(CS add0, CS add1, CS add2, CS add3, CS add4)
public CS addL(java.lang.Object add0)
public CS addD(double x)
public CS addF(float x)
public CS addJ(long x)
public CS addI(int x)
public CS addS(short x)
public CS addC(char x)
public CS addB(byte x)
public CS addZ(boolean x)
public java.lang.Object PL(int paramIndex, java.lang.Class castParamToThisType) throws CSCastException
CSCastException
public double PD(int paramIndex)
public float PF(int paramIndex)
PD(int)
public long PJ(int paramIndex)
PD(int)
public int PI(int paramIndex)
PD(int)
public short PS(int paramIndex)
PD(int)
public char PC(int paramIndex)
PD(int)
public byte PB(int paramIndex)
PD(int)
public boolean PZ(int paramIndex)
PD(int)
public java.lang.Object L(java.lang.Class castToThisType) throws CSCastException
CSCastException
Z()
,
B()
,
C()
,
S()
,
I()
,
J()
,
F()
,
D()
public abstract java.lang.Object LForProxy(java.lang.Class castToThisType) throws CSCastException
CSCastException
execProxy()
,
setExecProxy(CS)
public java.lang.Object L(int startIndex, java.lang.Object castToThisType, int indexQuantity)
L
in interface CodeSimian
public java.lang.Object L(int startIndex, java.lang.Class castToThisType, int indexQuantity) throws CSCastException
CSCastException
public abstract java.lang.Object LForProxy(int startIndex, java.lang.Class castToThisType, int indexQuantity) throws CSCastException
CSCastException
L(int,Class,int)
public java.lang.Object L(java.lang.String varName)
Static.defaultVarNames()
,
Static.defaultVarTypes()
public java.lang.Object L(java.lang.Object key)
L
in interface CodeSimian
public boolean setL(java.lang.Object key, java.lang.Object value)
setL
in interface CodeSimian
L(Object)
public void V()
Execute this CS. Do not return anything. V = Void.
Some CSs have side-effects (most at least have side effects recursively), so void is not useless.
public void VForProxy()
DForProxy()
public boolean Z()
execute this CS and cast to boolean. By default, all positive numbers are true, 0 & neg false.
Its called Z because B is used by byte, and java.lang.Class.name() uses Z for boolean.
All the functions that execute a CS have names equal to one of java.lang.Class.name();
public boolean ZForProxy()
DForProxy()
public byte B()
Execute this CS and cast to byte
public byte BForProxy()
DForProxy()
public char C()
Execute this CS and cast to char
public char CForProxy()
DForProxy()
public short S()
Execute this CS and cast to short
public short SForProxy()
DForProxy()
public int I()
Execute this CS and cast to int
public int IForProxy()
DForProxy()
public long J()
L(Class)
,
java.lang.Double.doubleToLongBits(double)
public long JForProxy()
DForProxy()
public float F()
Execute this CS and cast to float
public float FForProxy()
DForProxy()
public double D()
L(java.lang.Class)
public abstract double DForProxy()
public double minD()
public double maxD()
public abstract java.lang.Object prevL()
public boolean prevZ()
prevD()
public byte prevB()
prevD()
public char prevC()
prevD()
public short prevS()
prevD()
public int prevI()
prevD()
public long prevJ()
prevD()
public float prevF()
prevD()
public abstract double prevD()
public abstract boolean setL(java.lang.Object setToThisValue)
public abstract boolean setD(double setToThisValue)
public boolean setF(float setToThisValue)
setD(double)
public boolean setJ(long setToThisValue)
setD(double)
public boolean setI(int setToThisValue)
setD(double)
public boolean setS(short setToThisValue)
setD(double)
public boolean setC(char setToThisValue)
setD(double)
public boolean setB(byte setToThisValue)
setD(double)
public boolean setZ(boolean setToThisValue)
setD(double)
public abstract boolean setL1(int singleIndex, java.lang.Object value) throws CSCastException
setL1
in interface CodeSimian
CSCastException
public abstract boolean setL(int startIndex, java.lang.Object setToThisValue)
setL
in interface CodeSimian
setL(int,Object,int)
public boolean setL(java.lang.String varName, java.lang.Object value)
Static.defaultVarNames()
,
Static.defaultVarTypes()
public abstract boolean setL(int startIndex, java.lang.Object setToThisValue, int indexQuantity)
setL
in interface CodeSimian
public boolean setZ(int paramIndex, boolean value)
setD(int,double)
public boolean setB(int paramIndex, byte value)
setD(int,double)
public boolean setC(int paramIndex, char value)
setD(int,double)
public boolean setS(int paramIndex, short value)
setD(int,double)
public boolean setI(int paramIndex, int value)
setD(int,double)
public boolean setJ(int paramIndex, long value)
setD(int,double)
public boolean setF(int paramIndex, float value)
setD(int,double)
public abstract boolean setD(int paramIndex, double value)
public abstract boolean insertL1(int singleIndex, java.lang.Object value)
insertL1
in interface CodeSimian
public abstract boolean insertL(int startIndex, java.lang.Object insertMe)
insertL
in interface CodeSimian
insertL(int,Object,int)
public abstract boolean insertL(int startIndex, java.lang.Object insertMe, int indexQuantity)
public boolean insertZ(int paramIndex, boolean value)
insertD(int,double)
public boolean insertB(int paramIndex, byte value)
insertD(int,double)
public boolean insertC(int paramIndex, char value)
insertD(int,double)
public boolean insertS(int paramIndex, short value)
insertD(int,double)
public boolean insertI(int paramIndex, int value)
insertD(int,double)
public boolean insertJ(int paramIndex, long value)
insertD(int,double)
public boolean insertF(int paramIndex, float value)
insertD(int,double)
public abstract boolean insertD(int paramIndex, double value)
public abstract CS newInstance()
public CS parent()
public boolean setParent(CS parent)
parent()
public abstract java.lang.String name()
public boolean setName(java.lang.String newName)
public double cost()
public boolean setCost(float cost)
cost()
public abstract java.lang.String description()
public boolean setDescription(java.lang.String newDescription)
description()
public int parsePriority()
public boolean setParsePriority(int parsePriority)
parsePriority()
public abstract CS getExec()
public boolean setExec(CS newExecProxy)
getExec()
public CS proxyOf(java.lang.reflect.Method anyMethodInThisClass)
public boolean setProxyOf(java.lang.reflect.Method anyMethodInThisClass, CS proxy)
public abstract CS fuel()
public abstract boolean setFuel(CS newFuel)
fuel()
public abstract int myFuel()
public abstract boolean setMyFuel(int newValue)
myFuel()
public abstract boolean decrementMyFuel()
public java.lang.String toJavaCode(CSCallOptions options, JavaCodeWritingState state)
public byte overwrites(int index)
Indexs can be positive (up to index countP()-1) or negative. Use any of: public static final int EXECPROXY = -2; PREV = -3; FUEL = -4; MYFUEL = -5; NEWINSTANCE = -6; PARENT = -7; NAME = -8; DESCRIPTION = -9; PARSEPRIORITY = -10; JAVACODE = -11; HEAP = -12;
public byte isIllusion(int index)
overwrites(int)
,
S.isIllusion(int)
public abstract CS heap()
public boolean setHeap(CS newHeap)
heap()
public CS tester()
#setTester()
public boolean setTester(CS tester)
tester()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.Object reflect(java.lang.Object[] nameAndParameters)
CodeSimian
THE FOLLOWING CODE NEEDS TO BE CHECKED FOR RECURSIVE ARRAY ERRORS...
//These 4 examples do the same thing, but with increasing levels of reflection... Boolean setLReturnedTrue1 = new Boolean( someCS.setL(2,"countP",3) ); Boolean setLReturnedTrue2 = (Boolean) someL.reflect( new Object[]{"setL", new Integer(2), "countP", new Integer(3)} ); Boolean setLReturnedTrue3 = (Boolean) someL.reflect( new Object[]{ "reflect", new Object[]{"setL", new Integer(2), "countP", new Integer(3)} } ); Boolean setLReturnedTrue4 = (Boolean) someL.reflect( new Object[]{ "reflect", new Object[]{ "reflect", new Object[]{"setL", new Integer(2), "countP", new Integer(3)} } } ); Boolean setLReturnedTrue5 = (Boolean) someL.reflect( new Object[]{ "reflect", new Object[]{ "reflect", new Object[]{ "reflect", new Object[]{"setL", new Integer(2), "countP", new Integer(3)} } } } ); //Infinite reflection...
reflect
in interface CodeSimian
public java.lang.Object reflect(java.lang.String name, java.lang.Object[] parameters)
CodeSimian
reflect
in interface CodeSimian
public void voidReflect(java.lang.Object[] returnAndNameAndParameters)
CodeSimian
//USE THIS CODE IF YOU'RE LAZY (interfaces cant contain code): public void voidReflect(Object returnAndNameAndParameters[]){ Object nameAndParams[] = new Object[returnAndNameAndParameters.length-1]; //Insert code here to modify nameAndParams, if you want. System.arraycopy(nameAndParams, 0, returnAndNameAndParameters, 1, nameAndParams.length); returnAndNameAndParameters[0] = reflect(nameAndParams); }
voidReflect
in interface CodeSimian
public CodeSimian reflect6(java.lang.Class returnType, java.lang.Class instanceType, byte getSetInsertOrDelete, java.lang.Class locationType, byte quantityType, java.lang.Class valueType)
CodeSimian
reflect6
in interface CodeSimian
returnType
- - what the created function returns, or null if its void.instanceType
- - type of object the created function may be called on. Usually CS.class.getSetInsertOrDelete
- - get=0 set=1 insert=2 delete=3. All other numbers are wrapped around that range.locationType
- - usually int. After that most common are: double, String, or ClassquantityType
- - usually int. possibly double.
Or should this be the byte 0 for MANY (0 or more) or 1 for ALWAYS ONE. That would prevent double quantity type,
unless there were 4 possible values: INTMANY=0, INTONE=1, DOUBLEMANY=2, DOUBLEONE=3valueType
- - Any object or primitive type.
public abstract void setPrevExec(double d)
prevD()
@Deprecated public java.lang.Object getObject()
L(Class)
public boolean setObject(java.lang.Object setTo)
public abstract java.lang.String keyword()
parent()
,
newInstance()
,
name()
public boolean GETZ()
public byte GETB()
public char GETC()
public short GETS()
public int GETI()
public long GETJ()
public float GETF()
public double GETD()
public java.lang.Object GETL(java.lang.Class type)
public void SETZ(boolean z)
public void SETB(byte b)
public void SETC(char c)
public void SETS(short s)
public void SETI(int i)
public void SETJ(long j)
public void SETF(float f)
public void SETD(double d)
public void SETL(java.lang.Object l)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |