|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcodesimian.CS
codesimian.DefaultCS
codesimian.N
public class N
An efficient and flexible decimal NUMBER, with one instance var: double.
N is EFFICIENT because you can get/set its value directly as a public instance var.
Its FLEXIBLE because the param system can also be used to get/set its value.
Call setP(x) to set the number value to x.D().
For any x, P(x) returns this N.
There can be 0 or 1 params.
There never really is a param (even if countP()==1),
but P and setP etc can make it appear to have 1 param.
If countP()==0, the number value returned by DForProxy() still returns the current value,
which can instead be changed by changing the instace var 'value'.
| Field Summary | |
|---|---|
double |
value
value of this N |
| Fields inherited from class codesimian.CS |
|---|
DESCRIPTION, END, EXECPROXY, FUEL, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER |
| Constructor Summary | |
|---|---|
N()
|
|
N(boolean b)
|
|
N(byte b)
|
|
N(char c)
|
|
N(double d)
|
|
N(float f)
|
|
N(int i)
|
|
N(long L)
|
|
N(java.lang.Number n)
|
|
N(short s)
|
|
| Method Summary | |
|---|---|
CS |
addP(CS addMe)
always sets the value to addMe.D(), but if countP()==1 then returns false to show the countP did not increase |
int |
countP()
0 or 1. |
boolean |
deleteP(int index)
WARNING: if returns false, could have deleted but not moved other params down 1 index. WARNING: if duplicates not allowed, can not slide params down 1 index the standard way, returns false. |
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()
returns 'value' |
java.lang.String |
javaCode(CS listOfCodeAlreadyTraversed)
This will work with the basic operators like + / * - and probably a few others, but complex CSs will have to override this function to specify how to translate itself into Java code in combination with its children and descendent CSs. |
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()". |
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 |
newInstance()
temporarily, uses Class objects to instantiate the default constructor. |
CS |
P(int index)
returns this CS. |
boolean |
setD(double d)
all setX functions return setD by default. |
boolean |
setL(java.lang.Object o)
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 |
setP(int index,
CS newValue)
sets the value of this N to newValue.D(). |
java.lang.String |
toStringG(java.util.HashSet h)
|
| Methods inherited from class codesimian.DefaultCS |
|---|
B, C, decrementMyFuel, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, LForProxy, LForProxy, myFuel, name, objectToCS, objectToCSArray, objectToCSArray, prevD, prevL, PType, S, setB, setC, setCountP, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL1, setMyFuel, setName, setObject, setPrevExec, setS, setZ, start, toString, V, Z |
| Methods inherited from class codesimian.CS |
|---|
addP, addP, addP, addP, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, IForProxy, isIllusion, javaCode, 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, 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 |
| Field Detail |
|---|
public double value
| Constructor Detail |
|---|
public N()
public N(double d)
public N(float f)
public N(byte b)
public N(char c)
public N(short s)
public N(int i)
public N(long L)
public N(boolean b)
public N(java.lang.Number n)
| Method Detail |
|---|
public double DForProxy()
DForProxy in class DefaultCSpublic CS P(int index)
P in class DefaultCSindex - range 0 to countP()-1 inclusiveCS.heap()
public boolean setP(int index,
CS newValue)
setP in class DefaultCSpublic int countP()
countP in class DefaultCSpublic boolean deleteP(int index)
DefaultCS
deleteP in class DefaultCSpublic CS addP(CS addMe)
addP in class CSpublic CS newInstance()
DefaultCS
newInstance in class DefaultCSpublic java.lang.String keyword()
DefaultCS
keyword in class DefaultCSCS.parent(),
CS.newInstance(),
CS.name()public int minP()
DefaultCS
minP in class DefaultCSpublic java.lang.String description()
CS
description in class DefaultCSpublic java.lang.String toStringG(java.util.HashSet h)
public boolean setD(double d)
DefaultCS
setD in class DefaultCSpublic boolean setL(java.lang.Object o)
CS
setL in class DefaultCSpublic java.lang.String javaCode(CS listOfCodeAlreadyTraversed)
DefaultCS
javaCode in class DefaultCS
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||