public class If extends Instruction
To evaluate an IF instruction the expression is evaluated first, this determines if the instruction list will be run or not. This instruction list is executed the appropriate number of times the expression is not 0.
The value returned by evaluating an IF instruction is the expression and the instruction list.
Modifier and Type | Field and Description |
---|---|
private StrictInstructionList |
instructionList |
private ArithmeticBase |
varOrCommand |
gelementsToValue
Constructor and Description |
---|
If(ArithmeticBase e,
StrictInstructionList sil)
Constructs a Repeat instruction that can be executed.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
evaluate(Context c)
Evaluate this instruction in a Context.
|
java.lang.String |
toString() |
private ArithmeticBase varOrCommand
private StrictInstructionList instructionList
public If(ArithmeticBase e, StrictInstructionList sil)
e
- number to determine if the list should runsil
- strict instruction list that is the bodypublic java.lang.Object evaluate(Context c)
evaluate
in class Instruction
c
- the Context for the evaluationpublic java.lang.String toString()
toString
in class java.lang.Object