home *** CD-ROM | disk | FTP | other *** search
/ MACD 7 / MACD7.iso / www / weirdscience / classes / treedisplay.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-14  |  956 b   |  39 lines

  1. class TreeDisplay {
  2.    private int count;
  3.    private TreeNode[] nodeList;
  4.    private int length;
  5.  
  6.    public TreeDisplay(int var1) {
  7.       this.length = var1;
  8.       this.nodeList = new TreeNode[var1];
  9.    }
  10.  
  11.    public TreeNode getLine(int var1) {
  12.       return var1 >= this.length ? null : this.nodeList[var1];
  13.    }
  14.  
  15.    public void updateDisplay(Tree var1) {
  16.       TreeNode var2 = var1.getRoot();
  17.       if (var2 != null) {
  18.          for(int var3 = 0; var3 < this.length; ++var3) {
  19.             this.nodeList[var3] = null;
  20.          }
  21.  
  22.          this.count = 0;
  23.          var2 = var2.nextNode != null ? var2.nextNode : var2.subNode;
  24.          this.updateLoop(var2);
  25.       }
  26.    }
  27.  
  28.    private void updateLoop(TreeNode var1) {
  29.       if (var1 != null) {
  30.          this.nodeList[this.count++] = var1;
  31.          if (var1.data.open) {
  32.             this.updateLoop(var1.subNode);
  33.          }
  34.  
  35.          this.updateLoop(var1.nextNode);
  36.       }
  37.    }
  38. }
  39.