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$BreadthFirstEnumeration$Queue.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  2.0 KB  |  54 lines

  1. package com.sun.java.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 var1) {
  12.       if (this.head == null) {
  13.          this.head = this.tail = new DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode(this, var1, (DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode)null);
  14.       } else {
  15.          this.tail.next = new DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode(this, var1, (DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode)null);
  16.          this.tail = this.tail.next;
  17.       }
  18.    }
  19.  
  20.    public Object dequeue() {
  21.       if (this.head == null) {
  22.          throw new NoSuchElementException("No more elements");
  23.       } else {
  24.          Object var1 = this.head.object;
  25.          DefaultMutableTreeNode.BreadthFirstEnumeration.Queue.QNode var2 = this.head;
  26.          this.head = this.head.next;
  27.          if (this.head == null) {
  28.             this.tail = null;
  29.          } else {
  30.             var2.next = null;
  31.          }
  32.  
  33.          return var1;
  34.       }
  35.    }
  36.  
  37.    public Object firstObject() {
  38.       if (this.head == null) {
  39.          throw new NoSuchElementException("No more elements");
  40.       } else {
  41.          return this.head.object;
  42.       }
  43.    }
  44.  
  45.    public boolean isEmpty() {
  46.       return this.head == null;
  47.    }
  48.  
  49.    DefaultMutableTreeNode$BreadthFirstEnumeration$Queue(DefaultMutableTreeNode.BreadthFirstEnumeration var1) {
  50.       this.this$1 = var1;
  51.       this.this$1 = var1;
  52.    }
  53. }
  54.