|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--JavaPriorityQueue
IPriorityQueue implementation using unsorted Java Vector objects to hold the keys and elements.
Field Summary | |
protected Vector |
elements
Elements in this. |
protected Vector |
keys
Keys in this. |
Constructor Summary | |
JavaPriorityQueue()
Constructs a new unsorted priority queue. |
Method Summary | |
Object |
highest()
Returns an object in this associated with a highest priority key. |
Comparable |
highestKey()
Returns a highest priority key in this. |
void |
insertItem(Comparable key,
Object element)
Associates the given key and object and inserts them into this, increasing its size by 1. |
boolean |
isEmpty()
Returns whether or not this is empty. |
Object |
removeHighest()
Removes and returns the object in this associated with a highest priority key, reducing its size by 1. |
int |
size()
Returns the number of items in this. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected Vector keys
protected Vector elements
Constructor Detail |
public JavaPriorityQueue()
Method Detail |
public void insertItem(Comparable key, Object element)
insertItem
in interface IPriorityQueue
key
- representation of priority for the elementelement
- object to store in thispublic Object removeHighest()
removeHighest
in interface IPriorityQueue
RuntimeException
- if this is emptypublic Comparable highestKey()
highestKey
in interface IPriorityQueue
RuntimeException
- if this is emptypublic Object highest()
highest
in interface IPriorityQueue
RuntimeException
- if this is emptypublic int size()
size
in interface IPriorityQueue
public boolean isEmpty()
isEmpty
in interface IPriorityQueue
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |