net.sf.zig_project.gpl.common.queue
Class PriorityQueue

java.lang.Object
  extended bynet.sf.zig_project.gpl.common.queue.PriorityQueueBase
      extended bynet.sf.zig_project.gpl.common.queue.GenericPriorityQueue
          extended bynet.sf.zig_project.gpl.common.queue.PriorityQueue
All Implemented Interfaces:
OrderedBlockingQueue, OrderedQueue, Queue

public class PriorityQueue
extends GenericPriorityQueue
implements OrderedQueue

Single threaded, concrete implementation of a Priority Queue. Elements can be queued, collected, and prioritized prior to processing, then dequeued later by the same thread. (This class is not thread safe.)

Version:
January 20, 2005
Author:
Frank Ziglar

Nested Class Summary
 
Nested classes inherited from class net.sf.zig_project.gpl.common.queue.PriorityQueueBase
PriorityQueueBase.QueueSequencer
 
Field Summary
 
Fields inherited from class net.sf.zig_project.gpl.common.queue.PriorityQueueBase
queues
 
Constructor Summary
PriorityQueue(GenericQueue[] qs)
           
PriorityQueue(int max_pri)
          Convenience constructor for creating a priority queue, given the maximum priority it should support.
 
Method Summary
 Object removeNext()
          Removes the next Object from the queue.
 
Methods inherited from class net.sf.zig_project.gpl.common.queue.GenericPriorityQueue
add
 
Methods inherited from class net.sf.zig_project.gpl.common.queue.PriorityQueueBase
clear, contains, elements, getMaxPriority, isEmpty, peekNext, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.zig_project.gpl.common.queue.OrderedBlockingQueue
peekNext
 
Methods inherited from interface net.sf.zig_project.gpl.common.queue.Queue
clear, contains, elements, isEmpty, remove
 

Constructor Detail

PriorityQueue

public PriorityQueue(GenericQueue[] qs)

PriorityQueue

public PriorityQueue(int max_pri)
Convenience constructor for creating a priority queue, given the maximum priority it should support. The underlying queues are Fifo ordered LinkedQueues.

Parameters:
max_pri - the maximum priority this queue should support (inclusive).
Method Detail

removeNext

public Object removeNext()
Description copied from interface: OrderedQueue
Removes the next Object from the queue. This method always returns immediately. If the Queue is empty at the time this method is called, it will return null instead of waiting.

Specified by:
removeNext in interface OrderedQueue