jegg.impl
Class PriorityQueue

java.lang.Object
  extended byjegg.impl.PriorityQueue

public class PriorityQueue
extends java.lang.Object

A queue for objects that can be extracted from the queue in order of priority.

This container is not synchronized.


Constructor Summary
PriorityQueue()
           
 
Method Summary
 void add(Priority p, java.lang.Object o)
          Add a prioritized object to the queue.
 void clear()
          Empty the queue.
 boolean isEmpty()
          Return whether or not the queue is empty.
 java.lang.Object next()
          Return the next object on the queue in order of priority.
 java.lang.Object next(Priority p)
          Return the next object of a specific priority.
 int size()
          return the number of objects remaining on the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PriorityQueue

public PriorityQueue()
Method Detail

add

public void add(Priority p,
                java.lang.Object o)
Add a prioritized object to the queue.

Parameters:
p - the priority of the object.
o - the object to add to the queue.

next

public java.lang.Object next()
Return the next object on the queue in order of priority.

Returns:
the next object on the queue in order of priority.

next

public java.lang.Object next(Priority p)
Return the next object of a specific priority.

Parameters:
p - the priority of the next object to return.
Returns:
the next object of the specified priority.

size

public int size()
return the number of objects remaining on the queue.

Returns:
size of the queue.

clear

public void clear()
Empty the queue.


isEmpty

public boolean isEmpty()
Return whether or not the queue is empty.

Returns:
true if the queue is empty; otherwise, false.


Copyright © 2004 . All Rights Reserved.