|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjelan.elan.GrammarElement
jelan.elan.instruction.Instruction
jelan.elan.instruction.Repeat
public class Repeat
An AST (abstract syntax tree) for a SLogo REPEAT instruction. A REPEAT instruction has two components: (1) an expression representing the number of times to repeat the instructions that follow and (2) a strict instruction list that is the list of instructions that will be (repeatedly) executed.
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.
Constructor Summary | |
---|---|
Repeat(Expression e,
StrictInstructionList sil)
Constructs a Repeat instruction that can be executed. |
Method Summary | |
---|---|
java.lang.Object |
evaluate(Context c)
Evaluate this instruction in a Context. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Repeat(Expression e, StrictInstructionList sil)
e
- number of times to repeat the bodysil
- strict instruction list that is the bodyMethod Detail |
---|
public java.lang.Object evaluate(Context c)
evaluate
in class Instruction
c
- the Context for the evaluation
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |