E
- Element type. Should be Comparable
or a Comparator
needs to be given.public class TopBoundedUpdatableHeap<E> extends UpdatableHeap<E>
k
Elements only.Heap.UnorderedIter
Modifier and Type | Field and Description |
---|---|
protected int |
maxsize
Maximum size.
|
IN_TIES, index, NO_VALUE
comparator, queue, size
Constructor and Description |
---|
TopBoundedUpdatableHeap(int maxsize)
Constructor with maximum size only.
|
TopBoundedUpdatableHeap(int maxsize,
Comparator<? super E> comparator)
Constructor with maximum size and
Comparator . |
Modifier and Type | Method and Description |
---|---|
protected int |
compare(Object e,
Object object)
Test if the priority of an object is higher.
|
int |
getMaxSize()
Get the maximum size.
|
protected void |
handleOverflow(E e)
Handle an overflow in the structure.
|
void |
offerAt(int pos,
E e)
Offer element at the given position.
|
add, clear, heapifyDownComparable, heapifyDownComparator, heapifyUpComparable, heapifyUpComparator, poll, removeAt, removeObject, replaceTopElement
checkHeap, heapifyDown, heapifyUp, heapModified, isEmpty, peek, resize, size, unorderedIter
public TopBoundedUpdatableHeap(int maxsize)
maxsize
- Maximum sizepublic TopBoundedUpdatableHeap(int maxsize, Comparator<? super E> comparator)
Comparator
.maxsize
- Maximum sizecomparator
- Comparatorpublic void offerAt(int pos, E e)
UpdatableHeap
offerAt
in class UpdatableHeap<E>
pos
- Positione
- Elementprotected int compare(Object e, Object object)
e
- New objectobject
- Reference objectprotected void handleOverflow(E e)
e
- Overflowing element.public int getMaxSize()