public class DoubleDistanceIntegerDBIDSortedKNNList extends DoubleDistanceIntegerDBIDKNNList implements DoubleDistanceKNNHeap
k
dists, ids, size
Constructor and Description |
---|
DoubleDistanceIntegerDBIDSortedKNNList(int k)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double dist,
DBIDRef id)
Add an element.
|
protected void |
addInternal(double dist,
int id)
Add a new element to the heap/list.
|
double |
insert(double dist,
DBIDRef id)
Add a distance-id pair to the heap unless the distance is too large.
|
void |
insert(Double dist,
DBIDRef id)
Deprecated.
|
void |
insert(DoubleDistanceDBIDPair e)
Add a distance-id pair to the heap unless the distance is too large.
|
void |
insert(DoubleDistance dist,
DBIDRef id)
Deprecated.
|
private void |
insertionSort(double dist,
int id)
Insertion sort a single object.
|
DoubleDistanceIntegerDBIDPair |
peek()
Peek at the largest element in the heap.
|
DoubleDistanceIntegerDBIDPair |
poll()
Poll the largest element from the heap.
|
DoubleDistanceKNNList |
toKNNList()
Serialize to a
KNNList . |
String |
toString() |
doubleKNNDistance, getK, getKNNDistance
add, add, clear, contains, get, getDoubleDistance, grow, isEmpty, iter, reverse, size, sort, truncate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
doubleKNNDistance, getKNNDistance
clear, getK, isEmpty, size
get, iter
public DoubleDistanceIntegerDBIDSortedKNNList(int k)
k
- K parameterprotected final void addInternal(double dist, int id)
addInternal
in class DoubleDistanceIntegerDBIDList
dist
- Distanceid
- Object IDprivate void insertionSort(double dist, int id)
dist
- New distanceid
- New idpublic double insert(double dist, DBIDRef id)
DoubleDistanceKNNHeap
insert
in interface DoubleDistanceKNNHeap
dist
- Distance valueid
- ID numberpublic void add(double dist, DBIDRef id)
ModifiableDoubleDistanceDBIDList
add
in interface ModifiableDoubleDistanceDBIDList
add
in class DoubleDistanceIntegerDBIDList
dist
- Distanceid
- ID@Deprecated public void insert(Double dist, DBIDRef id)
DoubleDistanceKNNHeap
insert
in interface DoubleDistanceKNNHeap
dist
- Distance valueid
- ID numberpublic void insert(DoubleDistanceDBIDPair e)
DoubleDistanceKNNHeap
insert
in interface DoubleDistanceKNNHeap
e
- Existing distance pair@Deprecated public void insert(DoubleDistance dist, DBIDRef id)
DoubleDistanceKNNHeap
insert
in interface DoubleDistanceKNNHeap
insert
in interface KNNHeap<DoubleDistance>
dist
- Distance valueid
- ID numberpublic DoubleDistanceIntegerDBIDPair poll()
KNNHeap
KNNHeap.toKNNList()
.poll
in interface DoubleDistanceKNNHeap
poll
in interface KNNHeap<DoubleDistance>
public DoubleDistanceIntegerDBIDPair peek()
KNNHeap
peek
in interface DoubleDistanceKNNHeap
peek
in interface KNNHeap<DoubleDistance>
public DoubleDistanceKNNList toKNNList()
KNNHeap
KNNList
. This empties the heap!toKNNList
in interface DoubleDistanceKNNHeap
toKNNList
in interface KNNHeap<DoubleDistance>
public String toString()
toString
in class DoubleDistanceIntegerDBIDKNNList