home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / tree / DefaultMutableTreeNode$PostorderEnumeration.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.7 KB  |  39 lines

  1. package com.sun.java.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 var1, TreeNode var2) {
  13.       this.this$0 = var1;
  14.       this.this$0 = var1;
  15.       this.root = var2;
  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 var1;
  26.       if (this.subtree.hasMoreElements()) {
  27.          var1 = this.subtree.nextElement();
  28.       } else if (this.children.hasMoreElements()) {
  29.          this.subtree = new DefaultMutableTreeNode$PostorderEnumeration(this.this$0, (TreeNode)this.children.nextElement());
  30.          var1 = this.subtree.nextElement();
  31.       } else {
  32.          var1 = this.root;
  33.          this.root = null;
  34.       }
  35.  
  36.       return var1;
  37.    }
  38. }
  39.