P
- pair typeD
- distance typeabstract class AbstractKNNHeap<P extends DistanceDBIDPair<D>,D extends Distance<D>> extends Object implements KNNHeap<D>
Modifier and Type | Field and Description |
---|---|
protected TiedTopBoundedHeap<P> |
heap
The actual heap.
|
Constructor and Description |
---|
AbstractKNNHeap(int k)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the heap.
|
int |
getK()
Get the K parameter ("maxsize" internally).
|
abstract void |
insert(P pair)
Add a pair to the heap.
|
boolean |
isEmpty()
Test if the heap is empty.
|
P |
peek()
Peek at the largest element in the heap.
|
P |
poll()
Poll the largest element from the heap.
|
int |
size()
Current size of heap.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getKNNDistance, insert, toKNNList
protected final TiedTopBoundedHeap<P extends DistanceDBIDPair<D>> heap
public AbstractKNNHeap(int k)
k
- Maximum heap size (unless tied)public abstract void insert(P pair)
pair
- Pair to add.public final int getK()
KNNHeap
public int size()
KNNHeap
public P peek()
KNNHeap
public boolean isEmpty()
KNNHeap
public void clear()
KNNHeap
public P poll()
KNNHeap
KNNHeap.toKNNList()
.