public static class IlrSyntaxTree.Iterator
extends java.lang.Object
implements java.util.Iterator
IlrSyntaxTree.NodeTester object given as an argument in the
constructor. The iterator skips every node that fails the test.
Depending on the value of the direction parameter, the iterator does the following:
IlrSyntaxTree.DOWN: It iterates over the subnodes of the start
node, in a depth-first manner. The iterator starts at the start node, then
goes down its subnodes until if finds one that matches the tester. If none
is found when it reaches a leaf node, it then goes up again and continues
with the next sibling of this leaf node.IlrSyntaxTree.UP: It iterates over the supernodes of the start
node until the tree root node is reached.IlrSyntaxTree.LEFT: It iterates over the preceding siblings of the
start node, until it reaches the very first sibling node.IlrSyntaxTree.RIGHT: It iterates over the next siblings of the
start node, until it reaches the very last sibling node.IlrSyntaxTree.SUBNODES: It iterates over the subnodes of the start
node, and does not go deeper.The root node and its subnodes should not be modified while the iterator is in use.
| Constructor and Description |
|---|
IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root)
Constructs an instance of
Iterator. |
IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root,
IlrSyntaxTree.NodeTester tester)
Constructs an instance of
Iterator. |
IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root,
IlrSyntaxTree.NodeTester tester,
int direction)
Constructs an instance of
Iterator, using the specified
node as the root node. |
IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root,
int direction)
Constructs an instance of
Iterator. |
IlrSyntaxTree.Iterator(IlrSyntaxTree syntaxTree)
Constructs an instance of
Iterator. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Checks if there is a next node.
|
boolean |
hasNextNode()
Checks if there is a next node.
|
java.lang.Object |
next()
Gets the next node which satisfies the test.
|
IlrSyntaxTree.Node |
nextNode()
Gets the next node which satisfies the test.
|
void |
remove()
The
remove() method is not implemented. |
public IlrSyntaxTree.Iterator(IlrSyntaxTree syntaxTree)
Iterator. This iterator
iterates over all the nodes of syntaxTree in a depth-first
manner.syntaxTree - The syntax tree to iterate on.public IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root)
Iterator. This iterator
iterates over all the subnodes of node in a depth-first
manner.root - The root node of the syntax tree.public IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root, IlrSyntaxTree.NodeTester tester)
Iterator. This iterator
iterates over all the subnodes of node in a depth-first
manner. The tester is applied when looking for the next node.
This iterator returns only nodes which satisfy the tester.
root - The root node of the syntax tree.tester - The filter for the iteration. Only those nodes that satisfy
the test are included in the iteration.public IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root, int direction)
Iterator. This iterator
iterates over the syntax tree, starting from root, using
the specified direction.
The direction must be one of the following: IlrSyntaxTree.UP,
IlrSyntaxTree.DOWN,IlrSyntaxTree.LEFT,IlrSyntaxTree.RIGHT,IlrSyntaxTree.SUBNODES.
root - The root node of the syntax tree.direction - The direction the iterator takes when it navigates
through the syntax tree.public IlrSyntaxTree.Iterator(IlrSyntaxTree.Node root, IlrSyntaxTree.NodeTester tester, int direction)
Iterator, using the specified
node as the root node. This iterator iterates over the syntax tree,
starting from root, in the specified
direction. The tester will be applied when looking for
the next node.
This iterator only returns nodes which satisfy the tester.
The direction must be one of the following :IlrSyntaxTree.UP,
IlrSyntaxTree.DOWN,IlrSyntaxTree.LEFT,IlrSyntaxTree.RIGHT,IlrSyntaxTree.SUBNODES.
root - The root node of the syntax tree.tester - The filter for the iteration. Only those nodes that satisfy
the test are included in the iteration.direction - The direction the iterator takes when it navigates the
syntax tree.public boolean hasNextNode()
true if there is a next node, false
otherwise.public IlrSyntaxTree.Node nextNode()
null if
there is none.public boolean hasNext()
hasNext in interface java.util.Iteratortrue if there is a next node, false
otherwise.public java.lang.Object next()
next in interface java.util.Iteratornull if
there is none.public void remove()
remove() method is not implemented. The node tree
should not be modified while this iterator is in use.remove in interface java.util.Iteratorjava.lang.UnsupportedOperationException© Copyright IBM Corp. 1987, 2017