|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcodesimian.Static
public class Static
Static functions used in various subclasses of CS. CS should be as simple as possible, so these functions were moved from CS to Static. Many of them should be moved to whatever class they are most relevant to.
Nested Class Summary | |
---|---|
static class |
Static.AddDefaultCommand
wrapper for CSFactory.add(CS) |
static class |
Static.DefaultCommands
wrapper for Static.defaultListOfCSs() |
static class |
Static.DefaultExec
1/06 this is not the default exec anymore. |
static class |
Static.DefaultList
|
static class |
Static.DefaultStack
|
static class |
Static.SingletonList
|
Field Summary | |
---|---|
static int |
ALWAYS_CALCULATE
Deprecated. |
static java.lang.Number |
defaultMaxExecAdd
|
static java.lang.Number |
defaultMaxLoops
|
static java.lang.String |
optionsFileName
|
static StackNeverEmpty<CS> |
optionsStack
A stack of CS's. |
static boolean |
pPrints
|
Constructor Summary | |
---|---|
Static()
|
Method Summary | |
---|---|
static CS |
arrayToCS(java.lang.Object array)
converts any type of array to a CS, using objectToCS to interpret individual Objects |
static CS[] |
boundedGraphSet(CS root,
java.util.Set<CS> dontTraversePastThese,
boolean returnBounds)
Same as graphSet, except will not traverse past a given set of CSs. |
static CS |
collectionToCS(java.util.Collection c)
|
static boolean |
copyOptions(CS from,
CS to)
copies one CS's options to an other CS. |
static CS |
deepCopyExcept(CS root,
CS doNotCopyThese)
same as deepCopy(CS[]) but does not copy any of the CSs in doNotCopyThese (a list of CSs) or past them. |
static CS |
defaultCompiler()
note: the same type of compiler (with keyword "compile") exists in defaultListOfCSs() |
static java.lang.String |
defaultKeywordForClass(java.lang.Class c)
|
static CS |
defaultListOfCSs()
everything CodeSimian language includes before typing any code, like +(0 0), *(0 0), /(0 0), list(), sound(0), window(0), etc. |
static CS |
defaultStack()
|
static java.lang.String[] |
defaultVarNames()
returns the default variable names that can be used with CS.L(String) and CS.setL(String,Object); |
static java.lang.Class[] |
defaultVarTypes()
returns the Class types of the variables whose names are returned by defaultVarNames. |
static java.lang.String |
detailString(CS describeMe)
a longer string about this CS |
static boolean |
doubleToBoolean(double d)
Returns true if 0.0 < d, else false. |
static byte |
doubleToByte(double d)
|
static char |
doubleToChar(double d)
Wraps d around char range 0 - 127 (inclusive) and rounds; return (char) Math.round(wrapRange(-.5, d, 127.5)); |
static int |
doubleToInt(double d)
If d is in int range, returns d rounded to int. |
static int |
doubleToIntRange(int min,
double d,
int max)
The standard way to convert doubles to ints. |
static int |
doubleToIntRangeFasterIfInRange(int min,
double d,
int max)
like doubleToIntRange() except more efficient if d is already in range (just return d). |
static long |
doubleToLong(double d)
If d is in long range, returns d rounded to long. |
static short |
doubleToShort(double d)
|
static void |
err(java.lang.String errorText)
abbrev. |
static CS |
getCopyOfOption(java.lang.String optionName)
|
static CS |
getCopyOfOptions()
|
static CS |
getDefaultType()
This fuzzy-type always answers TRUE - everything is that type. |
static CS[] |
graphSet(CS root)
Returns an unordered array containing each CS in the parameter graph exactly once. |
static float |
minValueMax(float min,
float value,
float max)
returns value if its between min and max, else returns min or max |
static java.lang.String |
nextName()
CodeSimian allows the same CS to be in the string code multiple times. |
static CS |
objectToCS(java.lang.Object convertMeToCS)
Converts an Object to a CS by wrapping. |
static void |
p(java.lang.String println)
System.err.println |
static int |
paramIndex(CS[] array,
CS findMe)
returns the index or -1 if not found |
static CS |
peekOptions()
All new CSs should set their options to the same options as I have. For example: Num n = new Num(3.7); n.setRoot( CS.peekOptions().getRoot() ); But you do not have to do that, because setOptions() should do it automatically (not implemented yet 5/05). |
static CS |
popOptions()
|
static java.lang.String |
propertiesString(CS c)
Returns a String representing the variables: outputToStack, inputFromStack, and myFuel. |
static boolean |
pushOptions(CS pushMe)
|
static boolean |
setDefaultType(CS dt)
|
static CS[] |
setOfDuplicatesInGraph(CS root)
like graphSet(), but only returns the CSs that have 2 or more parents - duplicates. |
static CS |
staticCompile(java.lang.String code)
if you want to compile something but are confused, try this. |
static java.lang.String |
toStringG(CS root,
java.util.HashSet h)
Recursively builds a String from the GRAPH of CS parameters, using each CS exactly once. |
static java.lang.String |
toStringLimitDepth(CS currentCS,
java.util.HashSet noDuplicates,
int maxDepth)
like toStringG(HashSet) except limits depth. |
static java.lang.String |
toStringLimitDepth(CS root,
int maxDepth)
depth-first traversal of the param graph, with limited depth. |
static java.lang.String |
toStringOne(CS c)
this 1 CS, no paranthesis, possibly with modifiers. Example: +$3#nameOfThisPlus toString() might have returned (for that same example): +$3#nameOfThisPlus(1 2$7 *(3 4)) |
static java.lang.String |
toStringSafe(CS c)
minimum info about this CS. |
static double |
wrapRange(double min,
double wrapMe,
double max)
Wraps a double around a range. |
static float |
wrapRange(float min,
float wrapMe,
float max)
|
static double |
wrapRangeFasterIfInRange(double min,
double wrapMe,
double max)
Checks if wrapMe is in range, and returns wrapMe if so, else returns wrapRange(min,wrapMe,max). |
static double |
wrapRangeInclusive(double min,
double wrapMe,
double max)
never converts min to max or max to min |
static float |
wrapRangeInclusive(float min,
float wrapMe,
float max)
never converts min to max or max to min |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.lang.String optionsFileName
@Deprecated public static final int ALWAYS_CALCULATE
public static java.lang.Number defaultMaxExecAdd
public static java.lang.Number defaultMaxLoops
public static StackNeverEmpty<CS> optionsStack
pushOptions()
,
peekOptions()
,
popOptions()
public static boolean pPrints
Constructor Detail |
---|
public Static()
Method Detail |
---|
public static CS getCopyOfOptions()
public static CS getCopyOfOption(java.lang.String optionName)
public static CS defaultListOfCSs()
public static java.lang.String[] defaultVarNames()
public static java.lang.Class[] defaultVarTypes()
public static CS defaultCompiler()
public static CS getDefaultType()
public static boolean setDefaultType(CS dt)
public static CS defaultStack()
public static final byte doubleToByte(double d)
public static final short doubleToShort(double d)
public static final int doubleToInt(double d)
public static final long doubleToLong(double d)
public static final int doubleToIntRange(int min, double d, int max)
public static final int doubleToIntRangeFasterIfInRange(int min, double d, int max)
public static final boolean doubleToBoolean(double d)
public static final char doubleToChar(double d)
public static CS deepCopyExcept(CS root, CS doNotCopyThese)
public static int paramIndex(CS[] array, CS findMe)
public static boolean copyOptions(CS from, CS to)
public static double wrapRangeInclusive(double min, double wrapMe, double max)
public static float wrapRangeInclusive(float min, float wrapMe, float max)
public static double wrapRange(double min, double wrapMe, double max)
public static float wrapRange(float min, float wrapMe, float max)
public static double wrapRangeFasterIfInRange(double min, double wrapMe, double max)
public static CS[] graphSet(CS root)
public static CS[] setOfDuplicatesInGraph(CS root)
public static CS[] boundedGraphSet(CS root, java.util.Set<CS> dontTraversePastThese, boolean returnBounds)
public static CS staticCompile(java.lang.String code)
public static boolean pushOptions(CS pushMe)
optionsStack
public static CS popOptions()
optionsStack
public static CS peekOptions()
optionsStack
public static java.lang.String propertiesString(CS c)
public static java.lang.String toStringOne(CS c)
public static CS objectToCS(java.lang.Object convertMeToCS)
public static CS collectionToCS(java.util.Collection c)
public static CS arrayToCS(java.lang.Object array)
public static java.lang.String detailString(CS describeMe)
public static java.lang.String toStringSafe(CS c)
public static void err(java.lang.String errorText)
public static void p(java.lang.String println)
public static java.lang.String toStringLimitDepth(CS root, int maxDepth)
public static java.lang.String toStringLimitDepth(CS currentCS, java.util.HashSet noDuplicates, int maxDepth)
currentCS
- was added when this function was moved from CS to Static.public static java.lang.String nextName()
CodeSimian allows the same CS to be in the string code multiple times. Any CS in the code more than once must have a name (name()), but name() often returns null for anonymous. This function returns the name you should give this CS if that name is not a duplicate of some other name you're using. Example: +#adder(2 *#mul(3 4.5) mul adder 6 /#div(7 8) adder div) Then if you called setName(null) on that + and *, but not the /, the +'s decompile() should return something like... +#n20(2 *#n21(3 4.5) n21 n20 6 /#div(7 8) n20 div)
public static java.lang.String toStringG(CS root, java.util.HashSet h)
public static float minValueMax(float min, float value, float max)
public static java.lang.String defaultKeywordForClass(java.lang.Class c)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |