free MP3s recorded of codesimian: fractalSound1.mp3 b.mp3 c.mp3 d.mp3 but its more fun to create your own...

Start CodeSimian NOW (applet)

limited by internet security,
not all parts of CodeSimian work here.
Requires Java 1.5 and 2 ghz CPU

Download CodeSimian NOW (JAR file)

WORKS BEST. click OPEN,
or click SAVE then double-click CodeSimian.jar
Requires Java 1.5 and 2 ghz CPU

The One Root Class

all CodeSimian's Java-classes descend from 1 common class: CS

Intro/Tutorial | SourceCode | FAQ? | ListOfCommands | ~~Sounds/Audio (generated by equations)~~ | PlayElectricGuitarWithTheMouse | FREE MP3s (play and modify them with CodeSimian) | Pictures | Javadoc/TechnicalDocuments | CompareToJava | Plans (what to build) | RootClass | 1 Type | SystemReq | Humans | DNA | Bugs/Flaws | Wiki | Def | my resumE (give me a programming job) | Contact

View the JAVADOC for the root class.
View the JAVADOC for all files.



This grid of FUNCTIONS of the root-class shows how well CodeSimian REFLECTS Java.
Many functions come in all varieties of Object and primitive type.
This parallel structure allows many OPTIMIZATIONS. Example: if a CS stores its params as a double[] array, PD(int) could be modified to return the double from the array directly, instead of converting it to a CS then to a double.


GET SET INSERT DELETE
1 PARAMETER OF THIS CS P(int)
PL(int,Class) PD(int) PF(int) PJ(int) PI(int) PS(int) PC(int) PB(int) PZ(int)
setP(int,CS) setD(int,double) setF(int,float) setJ(int,long) setI(int,int) setS(int,short) setC(int,char) setB(int,byte) setZ(int,boolean) insertP(int,CS) insertD(int,double) insertF(int,float) insertJ(int,long) insertI(int,int) insertS(int,short) insertC(int,char) insertB(int,byte) insertZ(int,boolean) deleteP(int)
AT LEAST 1 PARAMETER OF THIS CS L(Class) L(Class,int) L(Class,int,int) setL(Object) setL(Object,int) setL(Object,int,int) insertL(int,Object) insertL(int,Object,int) deleteP(int,int)
VALUE OF THIS CS L(Class) D F J I S C B Z LForProxy DForProxy FForProxy JForProxy IForProxy SForProxy CForProxy BForProxy ZForProxy setL(Object) setD(double) setF(float) setJ(long) setI(int) setS(short) setC(char) setB(byte) setZ(boolean)
PREVIOUS VALUE OF THIS CS prevL prevD prevF prevJ prevI prevS prevC prevB prevZ L(Class) D F J I S C B Z LForProxy DForProxy FForProxy JForProxy IForProxy SForProxy CForProxy BForProxy ZForProxy

The sections of the root-class are explained below:



These first functions allow any CS to be interpreted or set as any Object or primitive type, or object array or primitive array, but some of these allow the CS to refuse at runtime. All functions with 1-letter names (except P(int)) EXECUTE the CS. Their names are the same as java.lang.Class.getName() uses.


Object L(Class castToThisType) throws ClassCastException;
Object LForProxy(Class castToThisType) throws ClassCastException;
boolean Z();
boolean ZForProxy();
byte B();
byte BForProxy();
char C();
char CForProxy();
short S();
short SForProxy();
int I();
int IForProxy();
long J();
long JForProxy();
float F();
float FForProxy();
double D();
double DForProxy();
void V();
void VForProxy();
boolean setL(Object setToThisValue);
boolean setD(double setToThisValue);
boolean setF(float setToThisValue);
boolean setJ(long setToThisValue);
boolean setI(int setToThisValue);
boolean setS(short setToThisValue);
boolean setC(char setToThisValue);
boolean setB(byte setToThisValue);
boolean setZ(boolean setToThisValue);

These PREV functions return the last thing that their single-letter counterparts above returned. They are not updated when setX is called (for any of the 9 Xs), only when this CS EXECUTES. They all refer to the same variable which can be interpreted as any type. Thats why theres 9 of them instead of 1. Since they're the same variable, for example, prevB() should return prevI() cast to byte, except for unexpected exceptions.


Object prevL();
boolean prevZ();
byte prevB();
char prevC();
short prevS();
int prevI();
long prevJ();
float prevF();
double prevD();

These next functions are for using a CS as a list of CSs. Example, the Add CS returns the sum of the CSs it contains.


CS P(int getParamWithThisIndex);
boolean setP(int setParamWithThisIndex, CS setTo);
boolean insertP(int insertParamAtThisIndex, CS insertMe);
CS deleteP(int deleteParamAtThisIndex);
int minP();
int countP();
int maxP();
int indexP(CS myParam);
int indexPName(String paramName);
CS pType(int paramIndex);
boolean setPType(int paramIndex, CS newTypeOfThatParam);

For convenience, these call setP(countP(),addx) for every parameter x, and return the CS addP was called from. Example:
byte two = new Multiply().addP(new Slidebar(.5),new N(4)).B();


CS addP(CS param);
CS addP(CS add0, CS 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);

The primary way to create new CS objects. Class objects and instance objects do not have to be separate. An instance can create an other instance like itself. That is the PROTOTYPE design pattern.
PARENT is the CS whose newInstance() created this CS. CS.keyword() will be replaced by CS.parent().name()


CS newInstance();

CS parent()
boolean setParent(CS parent)

Languages are made of strings:


String name();
boolean setName(String newName);

Optionally, describe this CS:


String description();
boolean setDescription(String newDescription);

Every CS (except proxies and LEAFs in the graph) must have a PROXY to control its execution. This reduces infinite loops and other problems, and allows very strange and complex behaviors. A proxy could have its own proxy... but it is not required or easy to implement. Example, you call x.Z(), the CS returned by x.execProxy() sets its param0 to x and calls param0.ZForProxy(), and that first x.Z() call returns what the proxy returns:


CS execProxy();
boolean setExecProxy(CS newExecProxy);

Fuel limits execution of CSs, to make sure none execute too much more than the others. Fuel is ENFORCED by PROXYs, but each subclass of CS must be designed to defer all EXECUTE functions (V Z B C S I J F D L) to the proxy (LForProxy ZForProxy...) for that to work. In a proxy, the relationship between X and XForProxy (for all X) is different [I'll write more about that later]. Depending on which proxy you choose, it might decrease fuel and not execute "?ForProxy()" if fuel runs out. There are 2 kinds of fuel. The CS fuel can be shared, and can distribute fuel in complex ways. The int fuel is individual to each CS:


boolean setFuel(CS newFuel);
CS fuel(); //inefficient but simple example: fuel().setD( fuel().D() - cost() )
int myFuel();
boolean setMyFuel(int newValue);
boolean decrementMyFuel();

double cost();
boolean setCost(double newCost);




This interface is flexible enough to handle any special functions your subclass of CS might do. All objects should be used as this interface type, not DefaultCS or their runtime type.

Most CSs can be used as some or all of: a list, function, variable, Java Object, Java primitive type, Object or primitive array.



Privacy Policy