
class DoubleIntegerDBIDPairKNNListHeap extends Object implements IntegerDBIDKNNList, KNNHeap
| Modifier and Type | Class and Description |
|---|---|
private class |
DoubleIntegerDBIDPairKNNListHeap.Itr
Iterator.
|
| Modifier and Type | Field and Description |
|---|---|
private DoubleIntegerDBIDPair[] |
data
The actual data array.
|
private int |
k
The value of k this was materialized for.
|
private int |
size
Current size
|
| Modifier | Constructor and Description |
|---|---|
protected |
DoubleIntegerDBIDPairKNNListHeap(int k)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the heap.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
DoubleIntegerDBIDPair |
get(int index)
Direct object access.
|
int |
getK()
Get the K parameter (note: this may be less than the size of the list!)
|
double |
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.
|
private void |
grow() |
void |
insert(DoubleDBIDPair e)
Add a distance-id pair to the heap unless the distance is too large.
|
double |
insert(double distance,
DBIDRef id)
Add a distance-id pair to the heap unless the distance is too large.
|
private void |
insertionSort(DoubleIntegerDBIDPair obj)
Perform insertion sort.
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
DoubleIntegerDBIDPairKNNListHeap.Itr |
iter()
Get a DBID iterator (a more efficient API).
|
DoubleIntegerDBIDPair |
peek()
Peek at the largest element in the heap.
|
DoubleIntegerDBIDPair |
poll()
Poll the largest element from the heap.
|
int |
size()
Size
|
KNNList |
toKNNList()
Serialize to a
KNNList. |
String |
toString() |
private void |
truncate() |
private final int k
private DoubleIntegerDBIDPair[] data
private int size
protected DoubleIntegerDBIDPairKNNListHeap(int k)
k - K parameterpublic void clear()
KNNHeappublic double insert(double distance,
DBIDRef id)
KNNHeapprivate void truncate()
public void insert(DoubleDBIDPair e)
KNNHeapprivate void insertionSort(DoubleIntegerDBIDPair obj)
obj - Object to insertprivate void grow()
public DoubleIntegerDBIDPair poll()
KNNHeapKNNHeap.toKNNList().public DoubleIntegerDBIDPair peek()
KNNHeappublic KNNList toKNNList()
KNNHeapKNNList. This empties the heap!public int getK()
KNNListpublic double getKNNDistance()
KNNListgetKNNDistance in interface KNNHeapgetKNNDistance in interface KNNListpublic DoubleIntegerDBIDPair get(int index)
KNNListget in interface DoubleDBIDListget in interface IntegerDBIDKNNListget in interface KNNListindex - Offsetpublic DoubleIntegerDBIDPairKNNListHeap.Itr iter()
DBIDs
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
DBID id = iter.getDBID();
}
iter in interface DBIDsiter in interface DoubleDBIDListiter in interface IntegerDBIDKNNListiter in interface IntegerDBIDspublic int size()
KNNListpublic boolean contains(DBIDRef o)
DBIDsCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.