|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweiss.util.AbstractCollection<AnyType>
weiss.util.PriorityQueue<AnyType>
public class PriorityQueue<AnyType>
PriorityQueue class implemented via the binary heap.
Constructor Summary | |
---|---|
PriorityQueue()
Construct an empty PriorityQueue. |
|
PriorityQueue(Collection<? extends AnyType> coll)
Construct a PriorityQueue from another Collection. |
|
PriorityQueue(Comparator<? super AnyType> c)
Construct an empty PriorityQueue with a specified comparator. |
Method Summary | |
---|---|
boolean |
add(AnyType x)
Adds an item to this PriorityQueue. |
void |
clear()
Make this PriorityQueue empty. |
AnyType |
element()
Returns the smallest item in the priority queue. |
Iterator<AnyType> |
iterator()
Returns an iterator over the elements in this PriorityQueue. |
AnyType |
remove()
Removes the smallest item in the priority queue. |
int |
size()
Returns the number of items in this PriorityQueue. |
Methods inherited from class weiss.util.AbstractCollection |
---|
contains, equals, hashCode, isEmpty, remove, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface weiss.util.Collection |
---|
contains, isEmpty, remove, toArray, toArray |
Constructor Detail |
---|
public PriorityQueue()
public PriorityQueue(Comparator<? super AnyType> c)
public PriorityQueue(Collection<? extends AnyType> coll)
Method Detail |
---|
public boolean add(AnyType x)
add
in interface Collection<AnyType>
add
in class AbstractCollection<AnyType>
x
- any object.
public int size()
size
in interface Collection<AnyType>
public void clear()
clear
in interface Collection<AnyType>
clear
in class AbstractCollection<AnyType>
public Iterator<AnyType> iterator()
iterator
in interface java.lang.Iterable<AnyType>
iterator
in interface Collection<AnyType>
public AnyType element()
element
in interface Queue<AnyType>
NoSuchElementException
- if empty.public AnyType remove()
remove
in interface Queue<AnyType>
NoSuchElementException
- if empty.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |