public class If extends Instruction
To evaluate a REPEAT instruction the expression is evaluated first, this determines the number of times the instruction list is executed. This instruction list is executed the appropriate number of times.
The value returned by evaluating a REPEAT instruction is the last value returned by evaluating the instruction list.
Modifier and Type | Field and Description |
---|---|
private ArithmeticBase |
expression |
private StrictInstructionList |
instructionList |
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 expression
private StrictInstructionList instructionList
public If(ArithmeticBase e, StrictInstructionList sil)
e
- number of times to repeat the bodysil
- 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