home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / debug / databind.jar / javax / awt / swing / tree / DefaultMutableTreeNode$PostorderEnumeration.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-19  |  1.9 KB  |  39 lines

  1. package javax.awt.swing.tree;
  2.  
  3. import java.util.Enumeration;
  4.  
  5. final class DefaultMutableTreeNode$PostorderEnumeration implements Enumeration {
  6.    // $FF: synthetic field
  7.    private final DefaultMutableTreeNode this$0;
  8.    protected TreeNode root;
  9.    protected Enumeration children;
  10.    protected Enumeration subtree;
  11.  
  12.    public DefaultMutableTreeNode$PostorderEnumeration(DefaultMutableTreeNode this$0, TreeNode rootNode) {
  13.       this.this$0 = this$0;
  14.       this.this$0 = this$0;
  15.       this.root = rootNode;
  16.       this.children = this.root.children();
  17.       this.subtree = DefaultMutableTreeNode.EMPTY_ENUMERATION;
  18.    }
  19.  
  20.    public boolean hasMoreElements() {
  21.       return this.root != null;
  22.    }
  23.  
  24.    public Object nextElement() {
  25.       Object retval;
  26.       if (this.subtree.hasMoreElements()) {
  27.          retval = this.subtree.nextElement();
  28.       } else if (this.children.hasMoreElements()) {
  29.          this.subtree = new DefaultMutableTreeNode$PostorderEnumeration(this.this$0, (TreeNode)this.children.nextElement());
  30.          retval = this.subtree.nextElement();
  31.       } else {
  32.          retval = this.root;
  33.          this.root = null;
  34.       }
  35.  
  36.       return retval;
  37.    }
  38. }
  39.