home *** CD-ROM | disk | FTP | other *** search
- package javax.awt.swing.tree;
-
- import java.util.Enumeration;
- import java.util.Stack;
- import java.util.Vector;
-
- final class DefaultMutableTreeNode$PreorderEnumeration implements Enumeration {
- // $FF: synthetic field
- private final DefaultMutableTreeNode this$0;
- protected Stack stack;
-
- public DefaultMutableTreeNode$PreorderEnumeration(DefaultMutableTreeNode this$0, TreeNode rootNode) {
- this.this$0 = this$0;
- this.this$0 = this$0;
- Vector v = new Vector(1);
- v.addElement(rootNode);
- this.stack = new Stack();
- this.stack.push(v.elements());
- }
-
- public boolean hasMoreElements() {
- return !this.stack.empty() && ((Enumeration)this.stack.peek()).hasMoreElements();
- }
-
- public Object nextElement() {
- Enumeration enumer = (Enumeration)this.stack.peek();
- TreeNode node = (TreeNode)enumer.nextElement();
- Enumeration children = node.children();
- if (!enumer.hasMoreElements()) {
- this.stack.pop();
- }
-
- if (children.hasMoreElements()) {
- this.stack.push(children);
- }
-
- return node;
- }
- }
-