net.scheinerman.phoenix.interpreter
Class WhileInterpreter
java.lang.Object
net.scheinerman.phoenix.interpreter.Interpreter
net.scheinerman.phoenix.interpreter.LoopInterpreter
net.scheinerman.phoenix.interpreter.WhileInterpreter
- Direct Known Subclasses:
- DoWhileInterpreter
public class WhileInterpreter
- extends LoopInterpreter
Extends the LoopInterpreter
to provide while looping functionality. The while loop provides
support for a loop that continues until a given ending condition (the while statement) evaluates to false
(zero).
- Since:
- 1.5
- Version:
- 1.0
- Author:
- Jonah Scheinerman
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 |
WhileInterpreter(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 while loop interpreter. |
Method Summary |
protected boolean |
isDone()
Returns true if the end statement evaluates to zero, false if the end statement evaluates
to a true (non-zero) value. |
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 |
whileStatement
protected java.lang.String whileStatement
WhileInterpreter
public WhileInterpreter(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 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 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()
- Returns
true
if the end statement evaluates to zero, false
if the end statement evaluates
to a true (non-zero) value. This determines whether the loop has ended.
- Overrides:
isDone
in class LoopInterpreter
- Returns:
true
if the loop should end, false
if not.