|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.jikesrvm.compilers.opt.util.TreeBottomUpEnumerator
final class TreeBottomUpEnumerator
This class provides enumeration of a tree in bottom-up order It guarantees that all children of a node will be visited before the parent. This is not necessarily the same as a bottom-up level walk.
| Field Summary | |
|---|---|
private ListIterator<TreeNode> |
iterator
an iterator of the above list |
private ArrayList<TreeNode> |
list
List of nodes in postorder |
| Constructor Summary | |
|---|---|
TreeBottomUpEnumerator(TreeNode root)
constructor: it creates the list of nodes |
|
| Method Summary | |
|---|---|
private void |
DFS(TreeNode node)
A postorder 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 |
|---|
TreeBottomUpEnumerator(TreeNode root)
root - Root of the tree whose elements are to be visited.| 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 | ||||||||||