codesimian
Class Compile.SmallSymbol

java.lang.Object
  extended by codesimian.CS
      extended by codesimian.IndependentCS
          extended by codesimian.Compile.SmallSymbol
All Implemented Interfaces:
CodeSimian
Direct Known Subclasses:
Compile.LParenSymbol, Compile.MyFuelSymbol, Compile.NameSymbol, Compile.RParenSymbol, Compile.WhitespaceSymbol
Enclosing class:
Compile

public abstract static class Compile.SmallSymbol
extends IndependentCS

a symbol that uses very little memory and has only 1 variable (a byte) specifying how many semicolons that precede the symbol. If the symbol is # and the variable is 4, keyword() returns ";;;;#".

The reason this class needs to use so little memory is that there are many parenthesis (and other symbols) in CodeSimian language. It averages to approximately 1 parenthesi per object, doubling the quantity of objects, but memory only increases by approximately 10% because IndependentCS (the parent class of SmallSymbol) contains NO VARIABLES.


Field Summary
 
Fields inherited from class codesimian.CS
DESCRIPTION, END, EXECPROXY, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS
 
Constructor Summary
Compile.SmallSymbol()
           
 
Method Summary
 byte B()
           
 byte BForProxy()
           
 double D()
          Execute this CS and cast to double.
 double DForProxy()
          Execute this CS and cast to double.
abstract  char getSymbol()
          examples: # ( )
 java.lang.String keyword()
          Returns the keyword of this CS or (after more code is finished) returns parent().name();

Keyword() needs to be removed.
 java.lang.String name()
          cant change this name because that would require a String variable and IndependentCS must use very little memory.
 CS newInstance()
          returns a new CS of this type with the same B() value
 java.lang.String semi(int quantity)
           
 boolean setB(byte b)
          set nonnegative quantity of semicolons
 boolean setD(double d)
          set nonnegative quantity of semicolons
 
Methods inherited from class codesimian.IndependentCS
C, CForProxy, countP, decrementMyFuel, deleteP, description, F, FForProxy, fuel, getExec, heap, I, IForProxy, insertD, insertL, insertL, insertL1, insertP, J, JForProxy, L, L, LForProxy, LForProxy, maxP, minP, myFuel, P, parent, prevD, prevL, PType, S, setD, setFuel, setL, setL, setL, setL1, setMyFuel, setP, setPrevExec, SForProxy, toString, V, VForProxy, Z, ZForProxy
 
Methods inherited from class codesimian.CS
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, clone, cost, deleteP, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, getObject, GETS, GETZ, indexP, indexPName, insertB, insertC, insertF, insertI, insertJ, insertS, insertZ, isIllusion, L, L, L, maxD, minD, overwrites, 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, setC, setCost, SETD, setDescription, setExec, setF, SETF, setF, setHeap, setI, SETI, setI, setJ, setJ, SETJ, SETL, setL, setL, setName, setObject, setParent, setParsePriority, setProxyOf, setPType, setS, setS, SETS, setTester, setZ, SETZ, setZ, tester, toJavaCode, voidReflect
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Compile.SmallSymbol

public Compile.SmallSymbol()
Method Detail

B

public byte B()
Overrides:
B in class IndependentCS
See Also:
Execute this CS and cast to byte

BForProxy

public byte BForProxy()
Overrides:
BForProxy in class IndependentCS
See Also:
CS.DForProxy()

setB

public boolean setB(byte b)
set nonnegative quantity of semicolons

Overrides:
setB in class CS
See Also:
CS.setD(double)

D

public double D()
Description copied from class: CS
Execute this CS and cast to double. All subclasses should override DForProxy() instead of D().

Overrides:
D in class IndependentCS
See Also:
CS.L(java.lang.Class)

DForProxy

public double DForProxy()
Description copied from class: CS
Execute this CS and cast to double.

D() and DForProxy() are the 2 most important functions in CS. They execute this CS. All other execute functions, by default, return DForProxy cast to their own type.

For example, J() calls the proxy which calls JForProxy() which calls DForProxy(). D() calls the proxy which calls DForProxy().

By default, all other primitive EXECUTE functions defer to D.
Functions that EXECUTE this CS: L(Class) L(int,Class,int) Z() B() C() S() I() J() F() D() V()

Overrides:
DForProxy in class IndependentCS

setD

public boolean setD(double d)
set nonnegative quantity of semicolons

Overrides:
setD in class IndependentCS

semi

public java.lang.String semi(int quantity)

getSymbol

public abstract char getSymbol()
examples: # ( )


keyword

public java.lang.String keyword()
Description copied from class: CS
Returns the keyword of this CS or (after more code is finished) returns parent().name();

Keyword() needs to be removed. Keyword() can only be removed from CS.java when the primary way to instantiate the default CS types is by using newInstance() on one of the CSs in a list of default CSs.

When you instantiate someCS with someCS.parent().newInstance(), someCS.keyword() can be replaced by someCS.parent().name().

keyword() appears in the code hundreds of times. Be careful when refactoring it out.

There is intentionally no setKeyword(String) in this interface. Dont add it.

Overrides:
keyword in class IndependentCS
See Also:
CS.parent(), CS.newInstance(), CS.name()

name

public java.lang.String name()
Description copied from class: IndependentCS
cant change this name because that would require a String variable and IndependentCS must use very little memory. Like CS, this class has no variables.

Overrides:
name in class IndependentCS

newInstance

public CS newInstance()
returns a new CS of this type with the same B() value

Overrides:
newInstance in class IndependentCS