net.scheinerman.phoenix.interpreter
Class DoWhileInterpreter
java.lang.Object
net.scheinerman.phoenix.interpreter.Interpreter
net.scheinerman.phoenix.interpreter.LoopInterpreter
net.scheinerman.phoenix.interpreter.WhileInterpreter
net.scheinerman.phoenix.interpreter.DoWhileInterpreter
public class DoWhileInterpreter
- extends WhileInterpreter
Extends the WhileInterpreter
to provide do while loop implementation in Phoenix. This alters the
isDone()
method to return false
on the first loop, and check the condition otherwise because do
while loops always execute on the first iteration.
- Since:
- 1.5
- Version:
- 1.0
- Author:
- Jonah Scheinerman
- See Also:
LoopInterpreter}
Field Summary |
protected boolean |
firstLoop
Indicates whether or not the first iteration of the loop has already occured. |
Fields inherited from class net.scheinerman.phoenix.interpreter.Interpreter |
_break, _continue, _return, breakValue, code, fat, file, keywordList, line, line_diff, printValues, retType, retTypeSet, retValue, run_code, stop, vat |
Constructor Summary |
DoWhileInterpreter(java.lang.String file,
java.lang.String code,
int line,
java.lang.String whileStatement,
java.util.LinkedList<java.util.HashMap<java.lang.String,Variable>> vat,
java.util.LinkedList<java.util.HashMap<java.lang.String,Function>> fat)
Creates a new do while loop interpreter. |
Method Summary |
protected boolean |
isDone()
Overrides LoopInterpreter.isDone() to return false on the first loop and check the ending
condition on any subsequent loops. |
Methods inherited from class net.scheinerman.phoenix.interpreter.Interpreter |
dealWithError, dealWithReturn, delete, doRun, getBlock, getFunction, getFunctionArguments, getFunctionFromDefinition, getReturnValue, getVariable, getWhitespace, initNewTables, isValidIdentifier, makeDefaultVariable, makeFunction, makeVariable, makeVariable, parsePhrase, putFunction, removeComments, removeWhitespace, retValueMatches |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
firstLoop
protected boolean firstLoop
- Indicates whether or not the first iteration of the loop has already occured.
DoWhileInterpreter
public DoWhileInterpreter(java.lang.String file,
java.lang.String code,
int line,
java.lang.String whileStatement,
java.util.LinkedList<java.util.HashMap<java.lang.String,Variable>> vat,
java.util.LinkedList<java.util.HashMap<java.lang.String,Function>> fat)
- Creates a new do while loop interpreter. This constructor provides the necessary requirements for any interpreter
subclass. The VAT and FAT of the enclosing interpreter, the file, the code section, the line number, and the ending
condition of the do while loop. Any subclasses must use these constructor arguments along with any others that they
might need for that specific implementation.
- Parameters:
file
- - The currently read file.code
- - The lines of code that are to be executed.line
- - The starting line number.whileStatement
- - The code phrase which provides the ending condition of the loop.vat
- - The enclosing interpreter's VAT.fat
- - The enclosing interpreter's FAT.
isDone
protected boolean isDone()
- Overrides
LoopInterpreter.isDone()
to return false
on the first loop and check the ending
condition on any subsequent loops.
- Overrides:
isDone
in class WhileInterpreter
- Returns:
true
if the loop should end, false
if not.