|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object Facemorph.PQ
public class PQ
Priority Queue class
Constructor Summary | |
---|---|
PQ()
Construct an empty PQ |
|
PQ(int maxsize)
Construct an empty PQ of initial size maxsize |
Method Summary | |
---|---|
void |
add(java.lang.Comparable c)
Adds an element to the PQ |
void |
clear()
Empty the array, alternatively could reallocate |
java.lang.Comparable |
inspectLeast()
Inspect but don't remove the smallest element |
boolean |
isEmpty()
Check if the heap is empty |
static void |
main(java.lang.String[] args)
Main method is used for testing |
java.lang.Comparable |
removeLeast()
remove the smallest element from the PQ |
int |
size()
Return the number of elements in the heap |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PQ()
public PQ(int maxsize)
maxsize
- the initial size of the internal storage arrayMethod Detail |
---|
public java.lang.Comparable inspectLeast()
inspectLeast
in interface IPQ
public void clear()
clear
in interface IPQ
public boolean isEmpty()
isEmpty
in interface IPQ
public int size()
size
in interface IPQ
public java.lang.Comparable removeLeast()
removeLeast
in interface IPQ
public void add(java.lang.Comparable c)
add
in interface IPQ
c
- the object to add to the PQpublic static void main(java.lang.String[] args)
args
- the command line args
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |