|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<Operator>
org.holtz.zoe.zoel.Operator
public enum Operator
The verb of an Operation
in a Zoel
program.
Binary operators first push any arg onto the stack.
Stack.0 is the right operand, and Stack.1 is the left.
Stack.0 is popped, and Stack.1 is replaced with the operation result.
If a string and a number are the operands
and the string can parse to a number, then it is treated as such,
else the number is treated as a string.
Unary operators first evaluate any arg and replace Stack.0 with it.
They then replace Stack.0 with the result of the operation on it.
Enum Constant Summary | |
---|---|
AbsoluteVal
Absolute value or string length. |
|
And
Iff stack top is true (nonzero/nonempty), evaluate arg. |
|
Bite
Bite energy from the nearest Bug or Joule within Feel/Bite range. |
|
Call
Use the string value of Stack.0 as the label to call. |
|
DividedBy
Arithmetic division or substring removal/extraction. |
|
Else
If Stack.0 is false (zero/empty), evaluate arg. |
|
EndTurn
End the current turn, preventing evaluation of remaining genes. |
|
Equals
|
|
Get
Copy a heap value to the stack, where arg is the map key. |
|
GreaterThan
|
|
IfThen
If Stack.0 is true (nonzero/nonempty), evaluate arg. |
|
LessThan
|
|
Mate
Set LastMate to the nearest visible bug that is within Feel range. |
|
Minus
Subtraction or string suffix removal. |
|
Modulus
Arithmetic modulus or string prefix removal. |
|
Mood
Set the Mood register. |
|
Move
Move forward along $Heading. |
|
Negate
Negation or string reversal. |
|
Not
Logical negation or string isEmpty. |
|
Or
If Stack.0 is false (zero/empty), evaluate arg. |
|
Plus
Addition or string concatenation. |
|
Pop
Pop the top off the stack. |
|
Print
Send a message to the gods. |
|
Push
Push the arg onto the stack. |
|
Random
Replace Stack.0 with a number 0 <= n < Stack.0. |
|
SenseFarther
Set It to the closest object farther than the current It. |
|
Set
Set a mapping in the heap, where arg is the map key and the stack top is the value. |
|
Spawn
Attempt to spawn a child using only available strength. |
|
Split
Attempt to split into a parent and child of equal size and strength. |
|
Times
Multiplication or tokenizing for strings. |
|
Turn
Turn to a different direction in order to Move that way. |
|
While
While Stack.0 is true (nonzero/nonempty), evaluate arg. |
Method Summary | |
---|---|
static Operator |
fromString(java.lang.String str)
|
boolean |
isBinary()
|
int |
maxNumArgs()
|
static Operator |
pseudoRandom(java.util.Random random,
boolean actionOperatorsAllowed)
|
static Operator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Operator[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
ZoelVM.Turn |
whetherTurnContinues()
|
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final Operator Move
public static final Operator Turn
public static final Operator Bite
public static final Operator Spawn
public static final Operator Split
public static final Operator Mate
public static final Operator EndTurn
public static final Operator SenseFarther
public static final Operator Mood
public static final Operator Print
public static final Operator Call
public static final Operator IfThen
public static final Operator Else
public static final Operator While
public static final Operator Push
public static final Operator Pop
public static final Operator Set
public static final Operator Get
public static final Operator And
public static final Operator Or
public static final Operator Equals
public static final Operator LessThan
public static final Operator GreaterThan
public static final Operator Plus
public static final Operator Minus
public static final Operator Times
public static final Operator DividedBy
public static final Operator Modulus
public static final Operator Not
public static final Operator Random
public static final Operator Negate
public static final Operator AbsoluteVal
Method Detail |
---|
public static Operator[] values()
for (Operator c : Operator.values()) System.out.println(c);
public static Operator valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is nullpublic boolean isBinary()
public int maxNumArgs()
public ZoelVM.Turn whetherTurnContinues()
public static Operator pseudoRandom(java.util.Random random, boolean actionOperatorsAllowed)
public static Operator fromString(java.lang.String str)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |