public class ExecutionNodePreorderIterator
extends java.lang.Object
Iterates preorder over the whole sub tree of a given IExecutionNode
.
Instances of this class should always be used instead of recursive method
calls because they cause StackOverflowError
s even in small programs.
Attention: The iteration process does not take care of changes in the model. If the containment hierarchy changes during iteration it is possible that elements are left or visited multiple times. For this reason it is forbidden to change the model during iteration. But the developer has to take care about it.
Constructor and Description |
---|
ExecutionNodePreorderIterator(IExecutionNode<?> start)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected IExecutionNode<?> |
getNextOnParent(IExecutionNode<?> node)
Returns the next element to select if all children of the given
IExecutionNode are visited. |
boolean |
hasNext()
Checks if more elements are available.
|
IExecutionNode<?> |
next()
Returns the next
IExecutionNode in the containment hierarchy. |
protected void |
updateNext()
Computes the next element and updates
next() . |
public ExecutionNodePreorderIterator(IExecutionNode<?> start)
start
- The IExecutionNode
to iterate over its sub tree.public boolean hasNext()
true
has more elements, false
has not more elements.public IExecutionNode<?> next()
IExecutionNode
in the containment hierarchy.IExecutionNode
.protected void updateNext()
next()
.protected IExecutionNode<?> getNextOnParent(IExecutionNode<?> node)
IExecutionNode
are visited.node
- The visited IExecutionNode
.IExecutionNode
to visit.Copyright © 2003-2019 The KeY-Project.