P
- pair typeD
- distance typepublic abstract class AbstractKNNHeap<P extends DistanceDBIDPair<D>,D extends Distance<D>> extends Object implements KNNHeap<D>
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractKNNHeap.Comp
Comparator to use.
|
Modifier and Type | Field and Description |
---|---|
static Comparator<? super DistanceDBIDPair<?>> |
COMPARATOR
Static comparator.
|
protected TiedTopBoundedHeap<P> |
heap
The actual heap.
|
Constructor and Description |
---|
AbstractKNNHeap(int k)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
add(P pair)
Add a pair to the heap.
|
void |
clear()
Clear the heap.
|
int |
getK()
Get the K parameter ("maxsize" internally).
|
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
add, getKNNDistance, toKNNList
public static final Comparator<? super DistanceDBIDPair<?>> COMPARATOR
protected final TiedTopBoundedHeap<P extends DistanceDBIDPair<D>> heap
public AbstractKNNHeap(int k)
k
- Maximum heap size (unless tied)public abstract void add(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()
.