/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Queue: implements a simple queue mechanism. Allows for enumeration of the
* elements.
*
* @author Herb Jellinek
*/
public class Queue {
public Queue() {
}
/**
* Enqueue an object.
*/
length = 1;
} else {
length++;
}
notify();
}
/**
* Dequeue the oldest object on the queue. Will wait indefinitely.
*
* @return the oldest object on the queue.
* @exception java.lang.InterruptedException if any thread has
* interrupted this thread.
*/
return dequeue(0L);
}
/**
* Dequeue the oldest object on the queue.
* @param timeOut the number of milliseconds to wait for something
* to arrive.
*
* @return the oldest object on the queue.
* @exception java.lang.InterruptedException if any thread has
* interrupted this thread.
*/
throws InterruptedException {
}
} else {
}
length--;
}
/**
* Is the queue empty?
* @return true if the queue is empty.
*/
public synchronized boolean isEmpty() {
}
/**
* Returns an enumeration of the elements in Last-In, First-Out
* order. Use the Enumeration methods on the returned object to
* fetch the elements sequentially.
*/
return new LIFOQueueEnumerator(this);
}
/**
* Returns an enumeration of the elements in First-In, First-Out
* order. Use the Enumeration methods on the returned object to
* fetch the elements sequentially.
*/
return new FIFOQueueEnumerator(this);
}
}
}
}
}
queue = q;
}
public boolean hasMoreElements() {
}
synchronized (queue) {
}
}
throw new NoSuchElementException("FIFOQueueEnumerator");
}
}
queue = q;
}
public boolean hasMoreElements() {
}
synchronized (queue) {
}
}
throw new NoSuchElementException("LIFOQueueEnumerator");
}
}
class QueueElement {
}
}
}