public class DoubleDistanceDBIDPairKNNList extends Object implements DoubleDistanceKNNList
Modifier and Type | Class and Description |
---|---|
private class |
DoubleDistanceDBIDPairKNNList.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 |
---|---|
|
DoubleDistanceDBIDPairKNNList(Collection<DoubleDistanceDBIDPair> col,
int k)
Constructor.
|
protected |
DoubleDistanceDBIDPairKNNList(DoubleDistanceDBIDPairKNNHeap heap)
Constructor, to be called from KNNHeap only.
|
|
DoubleDistanceDBIDPairKNNList(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.
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
DoubleDistanceDBIDListIter |
iter()
Get an iterator
|
int |
size()
Size
|
String |
toString() |
private final int k
private final DoubleDistanceDBIDPair[] data
public DoubleDistanceDBIDPairKNNList(Collection<DoubleDistanceDBIDPair> col, int k)
col
- Existing collectionk
- K parameterprotected DoubleDistanceDBIDPairKNNList(DoubleDistanceDBIDPairKNNHeap heap)
KNNHeap.toKNNList()
instead!heap
- Calling heappublic DoubleDistanceDBIDPairKNNList(Heap<DoubleDistanceDBIDPair> heap, int k)
KNNHeap.toKNNList()
instead!heap
- Calling heapk
- Target number of neighbors (before ties)public int getK()
KNNList
getK
in interface KNNList<DoubleDistance>
@Deprecated public DoubleDistance getKNNDistance()
DoubleDistanceKNNList
getKNNDistance
in interface DoubleDistanceKNNList
getKNNDistance
in interface KNNList<DoubleDistance>
public double doubleKNNDistance()
DoubleDistanceKNNList
doubleKNNDistance
in interface DoubleDistanceKNNList
public DoubleDistanceDBIDPair get(int index)
KNNList
get
in interface DistanceDBIDList<DoubleDistance>
get
in interface DoubleDistanceKNNList
get
in interface KNNList<DoubleDistance>
index
- Offsetpublic DoubleDistanceDBIDListIter iter()
DistanceDBIDList
iter
in interface DBIDs
iter
in interface DistanceDBIDList<DoubleDistance>
iter
in interface DoubleDistanceKNNList
public int size()
KNNList
size
in interface DBIDs
size
in interface DistanceDBIDList<DoubleDistance>
size
in interface KNNList<DoubleDistance>
public boolean contains(DBIDRef o)
DBIDs