|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jikesrvm.compilers.opt.util.TreeTopDownEnumerator
final class TreeTopDownEnumerator
This class provides enumeration of elements of a tree in a town-down manner It guarantees that all children of a node will only be visited after the parent. This is not necessarily the same as a top-down level walk.
| Field Summary | |
|---|---|
private ListIterator<TreeNode> |
iterator
an iterator of the above list |
private ArrayList<TreeNode> |
list
List of nodes in preorder |
| Constructor Summary | |
|---|---|
TreeTopDownEnumerator(TreeNode root)
constructor: it creates the list of nodes |
|
| Method Summary | |
|---|---|
private void |
DFS(TreeNode node)
A preorder depth first traversal, adding nodes to the list |
boolean |
hasMoreElements()
any elements left? |
TreeNode |
nextElement()
returns the next element in the list iterator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private final ArrayList<TreeNode> list
private final ListIterator<TreeNode> iterator
| Constructor Detail |
|---|
TreeTopDownEnumerator(TreeNode root)
root - Root of the tree to traverse| Method Detail |
|---|
public boolean hasMoreElements()
hasMoreElements in interface Enumeration<TreeNode>public TreeNode nextElement()
nextElement in interface Enumeration<TreeNode>private void DFS(TreeNode node)
node -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||