public class DoubleDistanceKNNList extends Object implements KNNResult<DoubleDistance>
Modifier and Type | Class and Description |
---|---|
private class |
DoubleDistanceKNNList.Itr
Iterator.
|
Modifier and Type | Field and Description |
---|---|
private DoubleDistanceDBIDPair[] |
data
The actual data array.
|
private int |
k
The value of k this was materialized for.
|
Modifier | Constructor and Description |
---|---|
|
DoubleDistanceKNNList(Collection<DoubleDistanceDBIDPair> col,
int k)
Constructor.
|
protected |
DoubleDistanceKNNList(DoubleDistanceKNNHeap heap)
Constructor, to be called from KNNHeap only.
|
|
DoubleDistanceKNNList(Heap<DoubleDistanceDBIDPair> heap,
int k)
Constructor, to be called from KNNHeap only.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
double |
doubleKNNDistance()
Get the kNN distance as double value.
|
DoubleDistanceDBIDPair |
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.
use doubleKNNDistance()!
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
DoubleDistanceDBIDResultIter |
iter()
Get an iterator
|
int |
size()
Size
|
String |
toString() |
private final int k
private final DoubleDistanceDBIDPair[] data
public DoubleDistanceKNNList(Collection<DoubleDistanceDBIDPair> col, int k)
col
- Existing collectionk
- K parameterprotected DoubleDistanceKNNList(DoubleDistanceKNNHeap heap)
KNNHeap.toKNNList()
instead!heap
- Calling heappublic DoubleDistanceKNNList(Heap<DoubleDistanceDBIDPair> heap, int k)
KNNHeap.toKNNList()
instead!heap
- Calling heapk
- Target number of neighbors (before ties)public int getK()
KNNResult
getK
in interface KNNResult<DoubleDistance>
@Deprecated public DoubleDistance getKNNDistance()
getKNNDistance
in interface KNNResult<DoubleDistance>
public double doubleKNNDistance()
public DoubleDistanceDBIDPair get(int index)
KNNResult
get
in interface DistanceDBIDResult<DoubleDistance>
get
in interface KNNResult<DoubleDistance>
index
- Offsetpublic DoubleDistanceDBIDResultIter iter()
DistanceDBIDResult
iter
in interface DBIDs
iter
in interface DistanceDBIDResult<DoubleDistance>
public int size()
KNNResult
size
in interface DBIDs
size
in interface DistanceDBIDResult<DoubleDistance>
size
in interface KNNResult<DoubleDistance>
public boolean contains(DBIDRef o)
DBIDs