E
- Object typepublic class TiedTopBoundedHeap<E> extends TopBoundedHeap<E>
TopBoundedHeap
, discarding elements
with the highest value. However, this variation keeps a list of tied
elements.Modifier and Type | Class and Description |
---|---|
class |
TiedTopBoundedHeap.UnorderedIter
Unordered heap iterator class.
|
Modifier and Type | Field and Description |
---|---|
private java.util.List<E> |
ties
List to keep ties in.
|
maxsize
comparator, queue, size
Constructor and Description |
---|
TiedTopBoundedHeap(int maxsize)
Constructor for Comparable objects.
|
TiedTopBoundedHeap(int maxsize,
java.util.Comparator<? super E> comparator)
Constructor with comparator.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the heap.
|
protected void |
handleOverflow(E e)
Handle an overflow in the structure.
|
E |
peek()
Peek at the top element.
|
E |
poll()
Remove the top element.
|
E |
replaceTopElement(E e)
Combined operation that removes the top element, and inserts a new element
instead.
|
int |
size()
Get the heap size.
|
TiedTopBoundedHeap.UnorderedIter |
unorderedIter()
Get an unordered heap iterator.
|
add, getMaxSize
checkHeap, heapifyDown, heapifyUp, heapModified, isEmpty, removeAt, resize
private java.util.List<E> ties
public TiedTopBoundedHeap(int maxsize, java.util.Comparator<? super E> comparator)
maxsize
- Maximum size of heap (unless tied)comparator
- Comparatorpublic TiedTopBoundedHeap(int maxsize)
maxsize
- Maximum size of heap (unless tied)public int size()
Heap
public void clear()
Heap
public E replaceTopElement(E e)
Heap
replaceTopElement
in class Heap<E>
e
- New element to insertprotected void handleOverflow(E e)
TopBoundedHeap
handleOverflow
in class TopBoundedHeap<E>
e
- Overflowing element.public TiedTopBoundedHeap.UnorderedIter unorderedIter()
unorderedIter
in class Heap<E>
Copyright © 2019 ELKI Development Team. License information.