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$BreadthFirstEnumeration$Queue.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-19  |  2.3 KB  |  55 lines

  1. package javax.awt.swing.tree;
  2.  
  3. import java.util.NoSuchElementException;
  4.  
  5. final class DefaultMutableTreeNode$BreadthFirstEnumeration$Queue {
  6.    // $FF: synthetic field
  7.    private final DefaultMutableTreeNode.BreadthFirstEnumeration this$1;
  8.    DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode head;
  9.    DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode tail;
  10.  
  11.    public void enqueue(Object anObject) {
  12.       if (this.head == null) {
  13.          this.head = this.tail = new DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode(this, anObject, (DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode)null);
  14.       } else {
  15.          this.tail.next = new DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode(this, anObject, (DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode)null);
  16.          this.tail = this.tail.next;
  17.       }
  18.  
  19.    }
  20.  
  21.    public Object dequeue() {
  22.       if (this.head == null) {
  23.          throw new NoSuchElementException("No more elements");
  24.       } else {
  25.          Object retval = this.head.object;
  26.          DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode oldHead = this.head;
  27.          this.head = this.head.next;
  28.          if (this.head == null) {
  29.             this.tail = null;
  30.          } else {
  31.             oldHead.next = null;
  32.          }
  33.  
  34.          return retval;
  35.       }
  36.    }
  37.  
  38.    public Object firstObject() {
  39.       if (this.head == null) {
  40.          throw new NoSuchElementException("No more elements");
  41.       } else {
  42.          return this.head.object;
  43.       }
  44.    }
  45.  
  46.    public boolean isEmpty() {
  47.       return this.head == null;
  48.    }
  49.  
  50.    DefaultMutableTreeNode$BreadthFirstEnumeration$Queue(DefaultMutableTreeNode.BreadthFirstEnumeration this$1) {
  51.       this.this$1 = this$1;
  52.       this.this$1 = this$1;
  53.    }
  54. }
  55.