drasys.or.cont
Interface PriorityQueueI

All Known Implementing Classes:
BinaryHeap, BinomialHeap

public interface PriorityQueueI

An interface used by all algorithms to use priority queues.

See Also:
BinaryHeap, BinomialHeap, PriorityQueue

Method Summary
 void changePriority(PairI element, java.lang.Object priority)
          Change the priority of a element in the queue.
 boolean check()
          Check the integrity of the internal data structures.
 java.util.Enumeration elements()
          Get an enumerator to access all the elements in random order.
 void ensureCapacity(int capacity)
          Ensure that the queue can hold this many elements.
 PairI getHead()
          Access the next element in the queue and leave the entry in the queue.
 PairI insert(java.lang.Object priority, java.lang.Object value)
          Insert a new element into the queue, with separate priority and value objects.
 PairI popHead()
          Access the next element in the queue and remove the entry from the queue.
 void removeAllElements()
          Remove all elements from the queue.
 void setCompare(CompareI compare)
          Sets a new comparison function.
 int size()
           
 

Method Detail

size

public int size()
Returns:
The number of elements in the queue.

removeAllElements

public void removeAllElements()
Remove all elements from the queue.

ensureCapacity

public void ensureCapacity(int capacity)
Ensure that the queue can hold this many elements.

elements

public java.util.Enumeration elements()
Get an enumerator to access all the elements in random order.
Returns:
The enumeration object retrieves the queue elements in random order and presents them as PairI interfaces. In the PairI, the first element is the priority object and the second element is the value object.

check

public boolean check()
Check the integrity of the internal data structures.
Throws:
CorruptedException - If the internal data structure is corrupted.

changePriority

public void changePriority(PairI element,
                           java.lang.Object priority)
                    throws InvalidPriorityException
Change the priority of a element in the queue.
Throws:
InvalidPriorityException - If the new priority is not supported.

getHead

public PairI getHead()
Access the next element in the queue and leave the entry in the queue.
Returns:
A PairI interface where the first element contains the priority object and the second contains the value object.

popHead

public PairI popHead()
Access the next element in the queue and remove the entry from the queue.
Returns:
A PairI interface where the first element contains the priority object and the second contains the value object.

insert

public PairI insert(java.lang.Object priority,
                    java.lang.Object value)
Insert a new element into the queue, with separate priority and value objects.
Returns:
A PairI interface that can be used to to access the new queue element.

setCompare

public void setCompare(CompareI compare)
Sets a new comparison function. This will empty the queue if it contains any objects.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com