org.mbari.siam.core
Class Queue

java.lang.Object
  extended by org.mbari.siam.core.Queue
All Implemented Interfaces:
java.lang.Runnable

public class Queue
extends java.lang.Object
implements java.lang.Runnable


Constructor Summary
Queue()
          Default Constructor
Queue(int capacity)
          Initializing Constructor
Queue(int capacity, QueueDispatcher dispatcher)
          Initializing Constructor
 
Method Summary
 java.lang.Object blockingDequeue()
          Block until an object is enqueued.
 java.lang.Object dequeue()
          Retrieve and remove the next element in the queue Return null if queue is empty.
 java.lang.Object dequeue(int index)
          Retrieve and remove the nth element in the queue Return null if queue is empty.
 java.lang.Object elementAt(int index)
          Return element at specified index
 java.util.Enumeration elements()
          Get enumerator over elements
 void enqueue(java.lang.Object o)
          Place on object in the queue
 void getNext()
          Get next object in queue and dispatch it.
 boolean isEmpty()
          Returns true if queue is empty
 java.lang.Object peek()
          Return Next Element without removing it from the queue
 void run()
          Queue thread main loop
 void setDispatcher(QueueDispatcher dispatcher)
          Set _dispatcher field
 void startQueue()
          Begin waiting for objects
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Queue

public Queue()
Default Constructor


Queue

public Queue(int capacity)
Initializing Constructor


Queue

public Queue(int capacity,
             QueueDispatcher dispatcher)
Initializing Constructor

Method Detail

setDispatcher

public void setDispatcher(QueueDispatcher dispatcher)
Set _dispatcher field


enqueue

public void enqueue(java.lang.Object o)
Place on object in the queue


dequeue

public java.lang.Object dequeue()
Retrieve and remove the next element in the queue Return null if queue is empty.


dequeue

public java.lang.Object dequeue(int index)
                         throws java.lang.ArrayIndexOutOfBoundsException
Retrieve and remove the nth element in the queue Return null if queue is empty.

Throws:
java.lang.ArrayIndexOutOfBoundsException

blockingDequeue

public java.lang.Object blockingDequeue()
Block until an object is enqueued. Returns object enqueued.


peek

public java.lang.Object peek()
                      throws java.lang.ArrayIndexOutOfBoundsException
Return Next Element without removing it from the queue

Throws:
java.lang.ArrayIndexOutOfBoundsException

elementAt

public java.lang.Object elementAt(int index)
                           throws java.lang.ArrayIndexOutOfBoundsException
Return element at specified index

Throws:
java.lang.ArrayIndexOutOfBoundsException

elements

public java.util.Enumeration elements()
Get enumerator over elements


isEmpty

public boolean isEmpty()
Returns true if queue is empty


getNext

public void getNext()
Get next object in queue and dispatch it.


startQueue

public void startQueue()
Begin waiting for objects


run

public void run()
Queue thread main loop

Specified by:
run in interface java.lang.Runnable


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.