E
- Element type. Should be Comparable
or a Comparator
needs to be given.public class TopBoundedUpdatableHeap<E> extends UpdatableHeap<E>
k
Elements only.Modifier and Type | Field and Description |
---|---|
protected int |
maxsize
Maximum size
|
private static long |
serialVersionUID
Serial version
|
IN_TIES, index, NO_VALUE
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() |
protected void |
handleOverflow(E e)
Handle an overflow in the structure.
|
boolean |
offerAt(int pos,
E e) |
clear, heapifyDownComparable, heapifyDownComparator, heapifyUpComparable, heapifyUpComparator, offer, poll, removeAt, removeObject
add, addAll, castQueueElement, checkHeap, contains, ensureValid, heapifyDown, heapifyUp, iterator, peek, resize, size, toSortedArrayList
element, remove
containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray
private static final long serialVersionUID
protected int maxsize
public TopBoundedUpdatableHeap(int maxsize)
maxsize
- Maximum sizepublic TopBoundedUpdatableHeap(int maxsize, Comparator<? super E> comparator)
Comparator
.maxsize
- Maximum sizecomparator
- Comparatorpublic boolean offerAt(int pos, E e)
offerAt
in class UpdatableHeap<E>
protected int compare(Object e, Object object)
e
- New objectobject
- Reference objectprotected void handleOverflow(E e)
e
- Overflowing element.public int getMaxSize()