|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodesimian.CS<CSGeneric>
codesimian.DefaultCS
codesimian.Const
public abstract class Const
A final constant number, selected at instantiation.
Const.DForProxy() is faster than Num.DForProxy(), because Num's value can change.
Java can optimize with Const better.
Contains (static final double) common constants, including the square-roots
and cube-roots of all prime-numbers up to 19, PI, E, and the golden-ratio.
Nested Class Summary | |
---|---|
static class |
Const.ConstByte
My only instance var is a byte. |
static class |
Const.ConstDouble
My only instance var is a double. |
static class |
Const.ConstFalse
I have no instance vars. |
static class |
Const.ConstFloat
My only instance var is a float. |
static class |
Const.ConstInt
My only instance var is a int. |
static class |
Const.ConstShort
My only instance var is a short. |
static class |
Const.ConstTrue
I have no instance vars. |
static class |
Const.ConstWithUselessParams
A constant value that can contain any quantity of params, but it never executes or does anything to them. |
Field Summary |
---|
Fields inherited from class codesimian.CS |
---|
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS |
Constructor Summary | |
---|---|
Const()
|
Method Summary | |
---|---|
static int |
constPoolSize()
quantity of Const's in the shared pool |
double |
cost()
default 0.4 |
double |
D()
for efficiency, does not use EXEC. |
boolean |
isConstant()
|
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. |
java.lang.String |
name()
returns the name of this CS. |
boolean |
needMoreInfo()
|
CS |
newInstance()
temporarily (need to write some more code), uses Class objects to instantiate the default constructor |
static Const |
pool(boolean value)
|
static Const |
pool(byte value)
|
static Const |
pool(char value)
Trys to return a Const from an array (value is index), very fast! Else uses pool(double). |
static Const |
pool(double value)
get a Const from the shared constant-pool, to save memory and cost of repeated instantiation of simple numbers. |
static Const |
pool(float value)
|
static Const |
pool(int value)
|
static Const |
pool(long value)
|
static Const |
pool(java.lang.Number value)
Same as the other pool()s. |
static Const |
pool(short value)
|
boolean |
setName(java.lang.String name)
false, Consts should not have names, only number values |
java.lang.String |
toString()
should i override decompile() also? or is that private? 8/06 I'm overriding toString() because I think Constants are getting printed in code as their name BEFORE they are given that name in that code. |
Methods inherited from class codesimian.DefaultCS |
---|
B, C, countP, decrementMyFuel, deleteP, description, DForProxy, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, LForProxy, LForProxy, myFuel, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setObject, setP, setPrevExec, setPType, setS, setZ, start, 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, 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 Const()
Method Detail |
---|
public double D()
D
in class CS
CS.L(java.lang.Class)
public int minP()
DefaultCS
minP
in class DefaultCS
public boolean isConstant()
public java.lang.String keyword()
DefaultCS
keyword
in class DefaultCS
CS.parent()
,
CS.newInstance()
,
CS.name()
public boolean needMoreInfo()
public double cost()
cost
in class CS
public CS newInstance()
DefaultCS
newInstance
in class DefaultCS
public static Const pool(double value)
public static Const pool(float value)
public static Const pool(long value)
public static Const pool(short value)
public static Const pool(byte value)
public static Const pool(char value)
public static Const pool(boolean value)
public static Const pool(java.lang.Number value)
public static Const pool(int value)
public static int constPoolSize()
public java.lang.String toString()
toString
in class DefaultCS
public java.lang.String name()
CS
name
in class DefaultCS
public boolean setName(java.lang.String name)
setName
in class DefaultCS
public 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 |