Class FOR_ListIterator
java.lang.Object
simula.runtime.FOR_ListIterator
The Implementation of the for-statement is a bit tricky. The basic idea is to create a ForList iterator that iterates over a set of ForElt iterators. The following subclasses of ForElt are defined:
FOR_SingleElt
with basic types T control variableFOR_SingleTValElt
with Text type control variableFOR_StepUntil
with numeric typesFOR_WhileElt
with basic types T control variableFOR_WhileTValElt
representing For t:=while with text value assignment
Each of which has a boolean method 'hasNext' indicating whether this for-element is exhausted. All parameters to these classes are transferred 'by name'. This is done to ensure that all expressions are evaluated in the right order. The assignment to the 'control variable' is done within the various for-elements when the 'next' method is invoked.
Simula for-statement for-list iterator
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final FOR_Element[]
The ForElt array.(package private) int
Current index into the ForElt array. -
Constructor Summary
ConstructorsConstructorDescriptionFOR_ListIterator
(FOR_Element... forElt) Create a ForListIterator consisting of an array of ForElt Iterators. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Field Details
-
forElt
The ForElt array. -
index
int indexCurrent index into the ForElt array.
-
-
Constructor Details
-
FOR_ListIterator
Create a ForListIterator consisting of an array of ForElt Iterators.- Parameters:
forElt
- an array of ForElt Iterators.
-
-
Method Details
-
hasNext
-
next
-