jdsl
Class SequenceSimplePriorityQueue

java.lang.Object
  |
  +--jdsl.SequenceSimplePriorityQueue
Direct Known Subclasses:
SequenceLocPriorityQueue

public class SequenceSimplePriorityQueue
extends java.lang.Object
implements SimplePriorityQueue

Implementation of a priority queue using a sorted sequence


Field Summary
protected  Comparator comp
           
protected  Sequence seq
           
 
Constructor Summary
SequenceSimplePriorityQueue(Comparator c)
           
 
Method Summary
 java.util.Iterator elements()
          Returns an iterator of the elements in this sequence
protected  java.lang.Object extractElem(java.lang.Object kep)
           
protected  java.lang.Object extractElem(Position pos)
           
protected  java.lang.Object extractKey(Position pos)
           
 void insertItem(java.lang.Object k, java.lang.Object e)
           
 boolean isEmpty()
           
 java.lang.Object minElement()
           
 java.lang.Object minKey()
           
 Container newContainer()
          Make a new container of this type using the same Comparator
 java.lang.Object removeMinElement()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seq

protected Sequence seq

comp

protected Comparator comp
Constructor Detail

SequenceSimplePriorityQueue

public SequenceSimplePriorityQueue(Comparator c)
Method Detail

extractKey

protected java.lang.Object extractKey(Position pos)

extractElem

protected java.lang.Object extractElem(Position pos)

extractElem

protected java.lang.Object extractElem(java.lang.Object kep)

size

public int size()

isEmpty

public boolean isEmpty()

insertItem

public void insertItem(java.lang.Object k,
                       java.lang.Object e)
                throws InvalidKeyException
Specified by:
insertItem in interface SimplePriorityQueue

minElement

public java.lang.Object minElement()
                            throws EmptyContainerException
Specified by:
minElement in interface SimplePriorityQueue

minKey

public java.lang.Object minKey()
                        throws EmptyContainerException
Specified by:
minKey in interface SimplePriorityQueue

removeMinElement

public java.lang.Object removeMinElement()
                                  throws EmptyContainerException
Specified by:
removeMinElement in interface SimplePriorityQueue

newContainer

public Container newContainer()
Make a new container of this type using the same Comparator

elements

public java.util.Iterator elements()
Returns an iterator of the elements in this sequence