|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcodesimian.CS
codesimian.DefaultCS
codesimian.Exec
public abstract class Exec
An EXEC is a wrapper class for CS.DForProxy().
A subclass can do whatever you want to CodeSimian language,
but the default does things like measure costs
and end infinite loops caused by cycles in a graph of code.
Other default (but not yet instantiated) options include to only return DForProxy()
or to only prevent infinite loops or neither or both etc.
This is a wrapper class for the execution of an other CS.
Use someExec.setP(0,x) then someExec.D() to execute x, instead of calling x.D() directly.
DForProxy() and D() are reversed.
In a normal CS, D() calls DForProxy() but never the reverse.
Here, DForProxy() calls D(), and D() does the work,
but external code should call D() directly and never call DForProxy().
Instead of targetCS.DForProxy(), normal CSs must call targetCS.D(),
which calls targetCS.exec.DForProxy(targetCS).
The first exec is an instance of this class. The second is this class's DForProxy() function.
That allows code to easily be inserted between all
CodeSimian operations, between parent and child.
Any CS that ever calls any CS's DForProxy() must
override execHacker() to return true.
Has inner classes: some implememtations of Exec interface,
combining the same few options in different combinations.
It is faster to use these inner classes like function-pointers than to
use if's to check if each option is enabled every execution (in 1 unified DForProxy()),
and that would not be as extendable.
| Nested Class Summary | |
|---|---|
static class |
Exec.Calc
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if: -- execMe.myFuel() <= 0 If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) This class automatically generated by Exec.javaCode(null, true, false, false, true) |
static class |
Exec.CalcFuel
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if either of: -- execMe.myFuel() <= 0 -- execMe.fuel().D() <= 0.0 If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) -- decreases execMe.fuel() by execMe.cost() This class automatically generated by Exec.javaCode(null, true, true, false, true) |
static class |
Exec.CalcFuelNan
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if any of: -- execMe.myFuel() <= 0 -- execMe.fuel().D() <= 0.0 -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) -- decreases execMe.fuel() by execMe.cost() This class automatically generated by Exec.javaCode(null, true, true, true, true) |
static class |
Exec.CalcFuelNanNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if any of: -- execMe.myFuel() <= 0 -- execMe.fuel().D() <= 0.0 -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) -- decreases execMe.fuel() by execMe.cost() WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, true, true, true, false) |
static class |
Exec.CalcFuelNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if either of: -- execMe.myFuel() <= 0 -- execMe.fuel().D() <= 0.0 If execMe is executed, CHANGES: -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) -- decreases execMe.fuel() by execMe.cost() WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, true, true, false, false) |
static class |
Exec.CalcNan
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if either of: -- execMe.myFuel() <= 0 -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) This class automatically generated by Exec.javaCode(null, true, false, true, true) |
static class |
Exec.CalcNanNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if either of: -- execMe.myFuel() <= 0 -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, true, false, true, false) |
static class |
Exec.CalcNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if: -- execMe.myFuel() <= 0 If execMe is executed, CHANGES: -- decrements execMe.myFuel (unless it equals CS.ALWAYS_CALCULATE) WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, true, false, false, false) |
static class |
Exec.Fuel
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if: -- execMe.fuel().D() <= 0.0 If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() -- decreases execMe.fuel() by execMe.cost() This class automatically generated by Exec.javaCode(null, false, true, false, true) |
static class |
Exec.FuelNan
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if either of: -- execMe.fuel().D() <= 0.0 -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() -- decreases execMe.fuel() by execMe.cost() This class automatically generated by Exec.javaCode(null, false, true, true, true) |
static class |
Exec.FuelNanNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if either of: -- execMe.fuel().D() <= 0.0 -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- decreases execMe.fuel() by execMe.cost() WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, false, true, true, false) |
static class |
Exec.FuelNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if: -- execMe.fuel().D() <= 0.0 If execMe is executed, CHANGES: -- decreases execMe.fuel() by execMe.cost() WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, false, true, false, false) |
static class |
Exec.Nan
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if: -- execMe.DForProxy() returns NaN, infinity, or -infinity. If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() This class automatically generated by Exec.javaCode(null, false, false, true, true) |
static class |
Exec.NanNoPrev
CS execMe = this.P(0); Normally returns execMe.DForProxy(), but returns execMe.prevD() if: -- execMe.DForProxy() returns NaN, infinity, or -infinity. WARNING: Sometimes returns prevExec, but never sets it. PrevExec might always be 0. This class automatically generated by Exec.javaCode(null, false, false, true, false) |
static class |
Exec.NoPrev
CS execMe = this.P(0); This class automatically generated by Exec.javaCode(null, false, false, false, false) |
static class |
Exec.SetPrevExecButNeverUseIt
CS execMe = this.P(0); If execMe is executed, CHANGES: -- sets execMe's prevExec to value of execMe.DForProxy() WARNING: Sets prevExec, but never returns or uses it. If you do not prevD() externally, this wastes cpu time. This class automatically generated by Exec.javaCode(SetPrevExecButNeverUseIt, false, false, false, true) |
static class |
Exec.SubclassDescription
describes a subclass of Exec that you are searching for. |
| Field Summary | |
|---|---|
static java.lang.String[] |
subclassNameLimitCalcExec
part of the (future) name of of automatically generated subclasses of Exec that limit DForProxy() by myFuel. |
static java.lang.String[] |
subclassNameLimitFuel
{"", "Fuel"} |
static java.lang.String[] |
subclassNameLimitValidNumber
{"", "Nan"} |
static java.lang.String[] |
subclassNameSetsPrevExec
{"NoPrev", ""} |
| Fields inherited from class codesimian.CS |
|---|
DESCRIPTION, END, EXECPROXY, FUEL, HEAP, JAVACODE, MYFUEL, NAME, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER |
| Constructor Summary | |
|---|---|
Exec()
|
|
| Method Summary | |
|---|---|
static void |
addSubclass(java.lang.Class subclassOfExec)
Add a new subclass of Exec at any time. For any subDesc where subDesc.equals(subclassInstance.getClassDescription()), Exec.getSubclass(subDesc) returns subclassInstance.getClass(). |
java.lang.String |
detailString()
|
double |
DForProxy()
reversed. |
Exec.SubclassDescription |
getClassDescription()
|
static java.lang.Class |
getSubclass(Exec.SubclassDescription sd)
Returns a subclass of Exec, probably automatically generated by javaCode(), with the specified options. |
static Exec |
instantiateSubclass(Exec.SubclassDescription sd)
returns a new instance of the subclass you describe, or null if class for that description not found |
static java.lang.String |
javaCode(java.lang.String name,
boolean limitCalcExec,
boolean limitFuel,
boolean limitValidNumber,
boolean setsPrevExec)
|
static java.lang.String |
javaCode(java.lang.String newClassName,
Exec.SubclassDescription sd)
Returns a string of Java code to be inserted in this class as inner classes, between "//START-GENERATED-CODE" and "//END-GENERATED-CODE". |
java.lang.String |
keyword()
return "exec."+getClass().getName(); |
java.lang.Object |
L(java.lang.Class castToThisType)
Optionally execute this CS, and definitely try to CAST it to the specified Java type. |
java.lang.Object |
L(int startIndex,
java.lang.Class castToThisType,
int indexQuantity)
same as L(Class) except only uses a subset of param indexs. Like many other L functions, allows optimizations of converting CSs to specific Object types. Example: new S("abcdefg").L(2,String.class,3) returns "cde". |
java.lang.Object |
LForProxy(java.lang.Class castToThisType)
reversed |
java.lang.Object |
LForProxy(int startIndex,
java.lang.Class castToThisType,
int indexQuantity)
reversed |
boolean |
limitCalcExec()
true if this.DForProxy(f) chooses to execute f or not depending on if f.myFuel is positive. |
boolean |
limitFuel()
true if this.DForProxy(f) chooses to execute f or not depending on the fuel contained in f's fuel() object. |
boolean |
limitValidNumber()
true if this.DForProxy(f) chooses to execute f or not depending on if f.DForProxy() is NaN, -infinity, or infinity. |
boolean |
setsPrevExec()
true if this.DForProxy(f) always sets (or returns) f's prevExec. |
| Methods inherited from class codesimian.DefaultCS |
|---|
B, C, countP, decrementMyFuel, deleteP, description, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, minP, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setS, setZ, start, toString, V, Z |
| Methods inherited from class codesimian.CS |
|---|
addP, addP, addP, addP, addP, BForProxy, CForProxy, clone, cost, D, deleteP, FForProxy, IForProxy, isIllusion, javaCode, JForProxy, 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 static java.lang.String[] subclassNameLimitCalcExec
public static java.lang.String[] subclassNameLimitFuel
public static java.lang.String[] subclassNameLimitValidNumber
public static java.lang.String[] subclassNameSetsPrevExec
| Constructor Detail |
|---|
public Exec()
| Method Detail |
|---|
public boolean limitCalcExec()
public boolean limitFuel()
public boolean limitValidNumber()
public boolean setsPrevExec()
public java.lang.Object L(java.lang.Class castToThisType)
CS
L in class CSCS.Z(),
CS.B(),
CS.C(),
CS.S(),
CS.I(),
CS.J(),
CS.F(),
CS.D()public java.lang.Object LForProxy(java.lang.Class castToThisType)
LForProxy in class DefaultCSexecProxy(),
setExecProxy(CS)
public java.lang.Object L(int startIndex,
java.lang.Class castToThisType,
int indexQuantity)
CS
L in class CS
public java.lang.Object LForProxy(int startIndex,
java.lang.Class castToThisType,
int indexQuantity)
LForProxy in class DefaultCSCS.L(int,Class,int)public java.lang.String keyword()
keyword in class DefaultCSCS.parent(),
CS.newInstance(),
CS.name()public double DForProxy()
DForProxy in class DefaultCSexecHacker()public java.lang.String detailString()
public static java.lang.Class getSubclass(Exec.SubclassDescription sd)
public static void addSubclass(java.lang.Class subclassOfExec)
public Exec.SubclassDescription getClassDescription()
public static Exec instantiateSubclass(Exec.SubclassDescription sd)
public static java.lang.String javaCode(java.lang.String newClassName,
Exec.SubclassDescription sd)
public static java.lang.String javaCode(java.lang.String name,
boolean limitCalcExec,
boolean limitFuel,
boolean limitValidNumber,
boolean setsPrevExec)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||