|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object structure.VectorHeap
public class VectorHeap
This class implements a priority queue based on a traditional array-based heap.
Constructor Summary | |
---|---|
VectorHeap()
Construct a new priority queue |
|
VectorHeap(Vector v)
Construct a new priority queue from an unordered vector |
Method Summary | |
---|---|
void |
add(Comparable value)
Add a value to the priority queue. |
void |
clear()
Remove all the elements from the queue. |
Comparable |
getFirst()
Fetch lowest valued (highest priority) item from queue. |
boolean |
isEmpty()
Determine if the queue is empty. |
Comparable |
remove()
Returns the minimum value from the queue. |
int |
size()
Determine the size of the queue. |
String |
toString()
Construct a string representation of the heap. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public VectorHeap()
public VectorHeap(Vector v)
Method Detail |
---|
public Comparable getFirst()
getFirst
in interface PriorityQueue
public Comparable remove()
remove
in interface PriorityQueue
public void add(Comparable value)
add
in interface PriorityQueue
value
- The value to be added.public boolean isEmpty()
isEmpty
in interface PriorityQueue
public int size()
size
in interface PriorityQueue
public void clear()
clear
in interface PriorityQueue
public String toString()
toString
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |