
public class DoubleDistanceIntegerDBIDPairKNNListHeap extends Object implements DoubleDistanceKNNList, DoubleDistanceKNNHeap
| Modifier and Type | Class and Description |
|---|---|
private class |
DoubleDistanceIntegerDBIDPairKNNListHeap.Itr
Iterator.
|
| Modifier and Type | Field and Description |
|---|---|
private DoubleDistanceIntegerDBIDPair[] |
data
The actual data array.
|
private int |
k
The value of k this was materialized for.
|
private int |
size
Current size
|
| Constructor and Description |
|---|
DoubleDistanceIntegerDBIDPairKNNListHeap(int k)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the heap.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
double |
doubleKNNDistance()
Get the kNN distance as double value.
|
DoubleDistanceIntegerDBIDPair |
get(int index)
Direct object access.
|
int |
getK()
Get the K parameter (note: this may be less than the size of the list!)
|
DoubleDistance |
getKNNDistance()
Deprecated.
|
private void |
grow() |
double |
insert(double distance,
DBIDRef id)
Add a distance-id pair to the heap unless the distance is too large.
|
void |
insert(Double distance,
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(DoubleDistanceIntegerDBIDPair obj)
Perform insertion sort.
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
DoubleDistanceIntegerDBIDListIter |
iter()
Get an iterator
|
DoubleDistanceIntegerDBIDPair |
peek()
Peek at the largest element in the heap.
|
DoubleDistanceIntegerDBIDPair |
poll()
Poll the largest element from the heap.
|
int |
size()
Size
|
DoubleDistanceKNNList |
toKNNList()
Serialize to a
KNNList. |
String |
toString() |
private void |
truncate() |
private final int k
private DoubleDistanceIntegerDBIDPair[] data
private int size
public DoubleDistanceIntegerDBIDPairKNNListHeap(int k)
k - K parameterpublic void clear()
KNNHeapclear in interface KNNHeap<DoubleDistance>public double insert(double distance,
DBIDRef id)
DoubleDistanceKNNHeapinsert in interface DoubleDistanceKNNHeapdistance - Distance valueid - ID numberprivate void truncate()
@Deprecated public void insert(Double distance, DBIDRef id)
DoubleDistanceKNNHeapinsert in interface DoubleDistanceKNNHeapdistance - Distance valueid - ID number@Deprecated public void insert(DoubleDistance dist, DBIDRef id)
DoubleDistanceKNNHeapinsert in interface DoubleDistanceKNNHeapinsert in interface KNNHeap<DoubleDistance>dist - Distance valueid - ID numberpublic void insert(DoubleDistanceDBIDPair e)
DoubleDistanceKNNHeapinsert in interface DoubleDistanceKNNHeape - Existing distance pairprivate void insertionSort(DoubleDistanceIntegerDBIDPair obj)
obj - Object to insertprivate void grow()
public DoubleDistanceIntegerDBIDPair poll()
KNNHeapKNNHeap.toKNNList().poll in interface DoubleDistanceKNNHeappoll in interface KNNHeap<DoubleDistance>public DoubleDistanceIntegerDBIDPair peek()
KNNHeappeek in interface DoubleDistanceKNNHeappeek in interface KNNHeap<DoubleDistance>public DoubleDistanceKNNList toKNNList()
KNNHeapKNNList. This empties the heap!toKNNList in interface DoubleDistanceKNNHeaptoKNNList in interface KNNHeap<DoubleDistance>public int getK()
KNNListgetK in interface KNNHeap<DoubleDistance>getK in interface KNNList<DoubleDistance>@Deprecated public DoubleDistance getKNNDistance()
DoubleDistanceKNNListgetKNNDistance in interface DoubleDistanceKNNHeapgetKNNDistance in interface DoubleDistanceKNNListgetKNNDistance in interface KNNHeap<DoubleDistance>getKNNDistance in interface KNNList<DoubleDistance>public double doubleKNNDistance()
DoubleDistanceKNNListdoubleKNNDistance in interface DoubleDistanceKNNHeapdoubleKNNDistance in interface DoubleDistanceKNNListpublic DoubleDistanceIntegerDBIDPair get(int index)
KNNListget in interface DistanceDBIDList<DoubleDistance>get in interface DoubleDistanceKNNListget in interface KNNList<DoubleDistance>index - Offsetpublic DoubleDistanceIntegerDBIDListIter iter()
DistanceDBIDListiter in interface DBIDsiter in interface DistanceDBIDList<DoubleDistance>iter in interface DoubleDistanceKNNListpublic int size()
KNNListsize in interface DBIDssize in interface DistanceDBIDList<DoubleDistance>size in interface KNNHeap<DoubleDistance>size in interface KNNList<DoubleDistance>public boolean contains(DBIDRef o)
DBIDs