|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
cornell.cs211.AbstractHeap<E>
E
- The type of the elements held in this collection.public abstract class AbstractHeap<E>
This class provides skeletal implementations of some Heap
operations. It is integrated with
Java Collection framework
A Heap implementation that extends this class must miniumally define methods push, pop and top
Heap
Field Summary | |
---|---|
protected java.util.Comparator<? super E> |
comparator
The comparator, or null if priority queue uses elements' natural ordering. |
Constructor Summary | |
---|---|
protected |
AbstractHeap(java.util.Comparator<? super E> comparator)
Construct with the given comparator which is used to decide the order of elements in the heap |
Method Summary | |
---|---|
boolean |
add(E o)
Adds the specified element to this heap. |
boolean |
addAll(java.util.Collection<? extends E> c)
Adds all of the elements in the specified collection to this queue. |
void |
clear()
Remove all the elements from the heap. |
Methods inherited from class java.util.AbstractCollection |
---|
contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface cornell.cs211.Heap |
---|
pop, push, top |
Methods inherited from interface java.util.Collection |
---|
contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
Field Detail |
---|
protected final java.util.Comparator<? super E> comparator
Constructor Detail |
---|
protected AbstractHeap(java.util.Comparator<? super E> comparator)
Method Detail |
---|
public boolean add(E o)
add
in interface java.util.Collection<E>
add
in class java.util.AbstractCollection<E>
public void clear()
clear
in interface java.util.Collection<E>
clear
in class java.util.AbstractCollection<E>
public boolean addAll(java.util.Collection<? extends E> c)
addAll
in interface java.util.Collection<E>
addAll
in class java.util.AbstractCollection<E>
c
- collection whose elements are to be added into this heap.
java.lang.NullPointerException
- if the specified collection is null.
java.lang.IllegalArgumentException
- if the specified collection is this heap.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |