Class Queue


  • public class Queue
    extends java.lang.Object
    Queue: implements a simple queue mechanism. Allows for enumeration of the elements.
    • Constructor Summary

      Constructors 
      Constructor Description
      Queue()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object dequeue()
      Dequeue the oldest object on the queue.
      java.lang.Object dequeue​(long timeOut)
      Dequeue the oldest object on the queue.
      void dump​(java.lang.String msg)  
      java.util.Enumeration elements()
      Returns an enumeration of the elements in Last-In, First-Out order.
      void enqueue​(java.lang.Object obj)
      Enqueue an object.
      boolean isEmpty()
      Is the queue empty?
      java.util.Enumeration reverseElements()
      Returns an enumeration of the elements in First-In, First-Out order.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Queue

        public Queue()
    • Method Detail

      • enqueue

        public void enqueue​(java.lang.Object obj)
        Enqueue an object.
      • dequeue

        public java.lang.Object dequeue()
                                 throws java.lang.InterruptedException
        Dequeue the oldest object on the queue. Will wait indefinitely.
        Returns:
        the oldest object on the queue.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted this thread.
      • dequeue

        public java.lang.Object dequeue​(long timeOut)
                                 throws java.lang.InterruptedException
        Dequeue the oldest object on the queue.
        Parameters:
        timeOut - the number of milliseconds to wait for something to arrive.
        Returns:
        the oldest object on the queue.
        Throws:
        java.lang.InterruptedException - if any thread has interrupted this thread.
      • isEmpty

        public boolean isEmpty()
        Is the queue empty?
        Returns:
        true if the queue is empty.
      • elements

        public final java.util.Enumeration elements()
        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.
      • reverseElements

        public final java.util.Enumeration reverseElements()
        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.
      • dump

        public void dump​(java.lang.String msg)