
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 | maxsizeMaximum size. | 
comparator, queue, size, validSize| 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 | 
|---|---|
| void | add(E e)Add an element to the heap. | 
| int | getMaxSize()Get the maximum size. | 
| protected void | handleOverflow(E e)Handle an overflow in the structure. | 
checkHeap, clear, ensureValid, heapifyDown, heapifyDownComparable, heapifyDownComparator, heapifyUp, heapifyUpComparable, heapifyUpComparator, heapModified, isEmpty, iterator, peek, poll, removeAt, replaceTopElement, resize, sizepublic TopBoundedHeap(int maxsize)
maxsize - Maximum sizepublic TopBoundedHeap(int maxsize,
              Comparator<? super E> comparator)
Comparator.maxsize - Maximum sizecomparator - Comparatorprotected void handleOverflow(E e)
e - Overflowing element.public int getMaxSize()