|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcodesimian.CS
public abstract class CS
CS is the root of all other classes! Its the top of the CodeSimian heirarchy.
Everything you need to know to add new Java code To CodeSimian is in this file.
Theoretically some parts of CodeSimian code (created at runtime)
will later be converted to Strings of Java code for a subclass of CS.java.
The existing subclasses of CS (in many combinations)
will generate new unique and useful subclasses of CS,
and those subclasses will build even smarter subclasses.
Since it will be Turing-Complete, these subclasses
will be flexible enough to contain a STRONG-ARTIFICIAL-INTELLIGENCE
without stepping outside-the-box of CodeSimian.
CodeSimian is designed to be used to create a Strong-AI that is
BACKWARDS-COMPATIBLE with CodeSimian because it is an ancestor (subclass of a subclass...) of CS.java.
Of course, such a software would be so advanced that it could only
be created by automatically generated evolved code many generations above Java...
GNU General Public License (GPL) ************
LEGAL: By using CodeSimian, you agree to the GPL license,
version 2 or higher (your choice), in file license.txt.
CodeSimian is FREE for most people ***
but BUSINESSES must pay $$$ to USE A DIFFERENT LICENSE.
CodeSimian: Copyright 2006, 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.
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 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();
In codesimian code, 2 times 3 times 4 is written as: *(2 3 4)
Any type-specific functions you need to call can be called dynamicly with a JavaMethod2 CS.
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 in the same group.
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 minP() is at least 1,
that measures the TYPE of its 1 param (the CS returned by theType.P(0)),
and returns a more positive number if its more like that type,
or 0 or less if it is not that type.
Its 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.
Each CS is a list of CSs containing a quantity of CSs between minP() and maxP() and equal to countP().
All functions whose names contain a capital P (except "Proxy" "Parse" 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.
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.
Thats probably because as a class its functions are in known positions in the table of functions,
but as an interface its functions could be in any position 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 (see Reflect.java).
8/06 I'm working on the solution to the class/interface problem.
CS implements interface CodeSimian, which contains only the most important functions.
All other functions can be reflected in terms of these few functions.
I've found some functions that must be included, but I've not decided all of which functions
will be in the final CodeSimian.java, which is the most important file in CodeSimian software.
Many functions use this CS as a list of CSs.
The default implementations are lazy and dont always throw IndexOutOfBoundsException's when they should.
5/06 I'm thinking about removing HEAP from class CS.
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
the lowest negative index reserved for CS reflection. |
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 |
FUEL
|
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
|
static int |
TESTER
|
| Constructor Summary | |
|---|---|
CS()
|
|
| Method Summary | |
|---|---|
CS |
addP(CS param)
Adds a new param at the end of the list. |
CS |
addP(CS add0,
CS add1)
same as addP(add0) && addP(add1). |
CS |
addP(CS add0,
CS add1,
CS add2)
|
CS |
addP(CS add0,
CS add1,
CS add2,
CS add3)
|
CS |
addP(CS add0,
CS add1,
CS add2,
CS add3,
CS add4)
|
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()
D() and DForProxy() are the 2 most important functions in CS. |
float |
F()
|
float |
FForProxy()
|
abstract CS |
fuel()
Fuel limits EXECUTION of CSs, to make sure none execute too much more than the others. |
abstract CS |
getExec()
Every CS must have an EXECPROXY (also called PROXY), even if its a trivial wrapper. |
java.lang.Object |
getObject()
Deprecated. |
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 here. |
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. WARNING: by default, like the other execute functions, J() calls D() and casts to J's type. long is the only primitive type that double has problems with. double maps to long correctly for all values between at least -(2^51) and 2^51 - 1. Past that, accuracy is less than integer precision. |
java.lang.String |
javaCode(CS listOfCodeAlreadyTraversed)
using this CS as the root, returns this CS and its children recursively as a String of JAVA CODE that often (but not always) does the same thing as executing this root CS. |
java.lang.String |
javaCode(CS listOfCodeAlreadyTraversed,
java.lang.Class returnType)
similar to javaCode(CS) except Class returnType specifies what type the java code should have. |
long |
JForProxy()
|
abstract java.lang.String |
keyword()
Deprecated. |
java.lang.Object |
L(java.lang.Class castToThisType)
Deprecated. Use L(Object) instead. |
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 optimizations of 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)
This function will replace L(String) and L(Class) and can do the same things as P(int) if "key" is a Number (uses Number.intValue()). |
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()
Returns the parsing priority of this CS type, in some language syntax, probably CodeSimian's. |
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 indexP)
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). |
short |
S()
|
boolean |
setB(byte setToThisValue)
|
boolean |
setB(int paramIndex,
byte value)
|
boolean |
setC(char setToThisValue)
|
boolean |
setC(int paramIndex,
char value)
|
boolean |
setCost(float cost)
Rename this to setCostToExecute() |
abstract boolean |
setD(double setToThisValue)
|
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)
|
boolean |
setF(int paramIndex,
float value)
|
abstract boolean |
setFuel(CS newFuel)
|
boolean |
setHeap(CS newHeap)
|
boolean |
setI(int setToThisValue)
|
boolean |
setI(int paramIndex,
int value)
|
boolean |
setJ(int paramIndex,
long value)
|
boolean |
setJ(long setToThisValue)
|
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. |
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) |
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)
|
boolean |
setTester(CS tester)
default: false |
boolean |
setZ(boolean setToThisValue)
|
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. |
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 EXECPROXY
public static final int PREV
public static final int FUEL
public static final int MYFUEL
public static final int NAME
public static final int NEWINSTANCE
public static final int PARENT
public static final int HEAP
public static final int DESCRIPTION
public static final int PARSEPRIORITY
public static final int JAVACODE
public static final int TESTER
public static final int END
| Constructor Detail |
|---|
public CS()
| Method Detail |
|---|
public abstract CS P(int index)
index - range 0 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 CodeSimianpublic 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 indexP)
public boolean setPType(int indexP,
CS newTypeOfThatParam)
public CS addP(CS param)
public CS addP(CS add0,
CS add1)
public CS addP(CS add0,
CS add1,
CS add2)
addP(CS)
public CS addP(CS add0,
CS add1,
CS add2,
CS add3)
addP(CS)
public CS addP(CS add0,
CS add1,
CS add2,
CS add3,
CS add4)
addP(CS)
public java.lang.Object PL(int paramIndex,
java.lang.Class castParamToThisType)
throws CSCastException
CSCastExceptionpublic 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
CSCastExceptionZ(),
B(),
C(),
S(),
I(),
J(),
F(),
D()
public abstract java.lang.Object LForProxy(java.lang.Class castToThisType)
throws CSCastException
CSCastExceptionexecProxy(),
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
CSCastExceptionL(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 CodeSimianL(Object)public void V()
Execute this CS. Do not return anything. V = Void.
Some CSs have side-effects, 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.java.lang.Class.name() uses Z for boolean.
All the functions that execute a CS have names equal to one of java.lang.java.lang.Class.name();\public boolean ZForProxy()
DForProxy()public byte B()
Execute this CS and cast to bytepublic byte BForProxy()
DForProxy()public char C()
Execute this CS and cast to charpublic char CForProxy()
DForProxy()public short S()
Execute this CS and cast to shortpublic short SForProxy()
DForProxy()public int I()
Execute this CS and cast to intpublic 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 floatpublic 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 boolean setL1(int singleIndex,
java.lang.Object value)
throws CSCastException
setL1 in interface CodeSimianCSCastException
public abstract boolean setL(int startIndex,
java.lang.Object setToThisValue)
setL in interface CodeSimiansetL(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 CodeSimianinsertL(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 javaCode(CS listOfCodeAlreadyTraversed)
public java.lang.String javaCode(CS listOfCodeAlreadyTraversed,
java.lang.Class returnType)
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.Objectjava.lang.CloneNotSupportedExceptionpublic 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 CodeSimianpublic 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 CodeSimianpublic abstract void setPrevExec(double d)
prevD()public java.lang.Object getObject()
L(Class)public boolean setObject(java.lang.Object setTo)
public abstract java.lang.String keyword()
parent(),
newInstance(),
name()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||