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, FUEL, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER
 
Constructor Summary
Compile.SmallSymbol()
           
 
Method Summary
 byte B()
           
 byte BForProxy()
           
 double D()
          Execute this CS and cast to double.
 double DForProxy()
          D() and DForProxy() are the 2 most important functions in CS.
 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
abstract  char symbolAfterSemicolons()
          examples: # ( )
 
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, setMyFuel, setP, setPrevExec, SForProxy, start, toString, V, VForProxy, Z, ZForProxy
 
Methods inherited from class codesimian.CS
addP, addP, addP, addP, addP, clone, cost, deleteP, getObject, indexP, indexPName, insertB, insertC, insertF, insertI, insertJ, insertS, insertZ, isIllusion, javaCode, javaCode, 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, setB, setC, setC, setCost, setDescription, setExec, setF, setF, setHeap, setI, setI, setJ, setJ, setL, setL, setL1, setName, setObject, setParent, setParsePriority, setProxyOf, setPType, setS, setS, setTester, setZ, setZ, tester, 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
D() and DForProxy() are the 2 most important functions in CS. They execute this CS. All other execute functions, by default, use DForProxy instead of reinventing-the-wheel for their own type.

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

Execute this CS and cast to double. D() is the main EXECUTE function. D() uses DForProxy(). DForProxy() is the main action of every CS, the most important function. 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)

symbolAfterSemicolons

public abstract char symbolAfterSemicolons()
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

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