
E - Element type. Should be Comparable or a Comparator needs to be given.public class TopBoundedHeap<E> extends Heap<E>
k Elements only.| Modifier and Type | Field and Description |
|---|---|
protected int |
maxsize
Maximum size
|
private static long |
serialVersionUID
Serial version
|
| Constructor and Description |
|---|
TopBoundedHeap(int maxsize)
Constructor with maximum size only.
|
TopBoundedHeap(int maxsize,
Comparator<? super E> comparator)
Constructor with maximum size and
Comparator. |
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxSize() |
protected void |
handleOverflow(E e)
Handle an overflow in the structure.
|
boolean |
offer(E e) |
castQueueElement, clear, compare, compareExternal, compareExternalExternal, contains, heapifyDown, heapifyUp, heapifyUpParent, iterator, peek, poll, putInQueue, removeAt, size, swap, toSortedArrayListadd, addAll, element, removecontainsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontainsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArrayprivate static final long serialVersionUID
protected int maxsize
public TopBoundedHeap(int maxsize)
maxsize - Maximum sizepublic TopBoundedHeap(int maxsize,
Comparator<? super E> comparator)
Comparator.maxsize - Maximum sizecomparator - Comparator