sjm.imperative
Class WhileCommand
java.lang.Object
|
+--sjm.imperative.Command
|
+--sjm.imperative.WhileCommand
- public class WhileCommand
- extends Command
This command mimics a normal "while" loop, executing
a command in a loop, so long as some condition holds
true.
|
Method Summary |
void |
execute()
Execute this "while" command. |
java.lang.String |
toString()
Returns a string description of this while command. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
condition
protected BooleanTerm condition
command
protected Command command
WhileCommand
public WhileCommand(BooleanTerm condition,
Command command)
- Construct a "while" command from the given condition
and command.
- Parameters:
condition - the condition to check each time
before executing the bodycommand - the command to repeatedly execute
execute
public void execute()
- Execute this "while" command. This means repeatedly
checking the condition, and executing command from
this object's command, so long as the condition is true.
- Overrides:
- execute in class Command
toString
public java.lang.String toString()
- Returns a string description of this while command.
- Overrides:
- toString in class java.lang.Object
- Returns:
- a string description of this while command