D
- Distance typepublic class KNNList<D extends Distance<D>> extends AbstractList<DistanceResultPair<D>> implements KNNResult<D>
Modifier and Type | Class and Description |
---|---|
private class |
KNNList.Itr
Iterator
|
Modifier and Type | Field and Description |
---|---|
private Object[] |
data
The actual data array.
|
private int |
k
The value of k this was materialized for.
|
modCount
Modifier | Constructor and Description |
---|---|
protected |
KNNList(KNNHeap<D> heap)
Constructor, to be called from KNNHeap only.
|
|
KNNList(Queue<D> heap,
int k)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
ArrayDBIDs |
asDBIDs()
View as ArrayDBIDs
|
List<D> |
asDistanceList()
View as list of distances
|
DistanceResultPair<D> |
get(int index)
Direct object access.
|
int |
getK()
Get the K parameter (note: this may be less than the size of the list!)
|
D |
getKNNDistance()
Get the distance to the k nearest neighbor, or maxdist otherwise.
|
Iterator<DistanceResultPair<D>> |
iterator() |
int |
size()
Size
|
String |
toString() |
add, add, addAll, clear, equals, hashCode, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
private final int k
private final Object[] data
protected KNNList(KNNHeap<D> heap)
KNNHeap.toKNNList()
instead!heap
- Calling heappublic KNNList(Queue<D> heap, int k)
KNNHeap.toKNNList()
instead!heap
- Calling heapk
- K valuepublic int getK()
KNNResult
public D getKNNDistance()
KNNResult
getKNNDistance
in interface KNNResult<D extends Distance<D>>
public ArrayDBIDs asDBIDs()
KNNResult
public List<D> asDistanceList()
KNNResult
asDistanceList
in interface KNNResult<D extends Distance<D>>
public String toString()
toString
in class AbstractCollection<DistanceResultPair<D extends Distance<D>>>
public DistanceResultPair<D> get(int index)
KNNResult
public Iterator<DistanceResultPair<D>> iterator()
iterator
in interface Iterable<DistanceResultPair<D extends Distance<D>>>
iterator
in interface Collection<DistanceResultPair<D extends Distance<D>>>
iterator
in interface List<DistanceResultPair<D extends Distance<D>>>
iterator
in class AbstractList<DistanceResultPair<D extends Distance<D>>>
public int size()
KNNResult
size
in interface KNNResult<D extends Distance<D>>
size
in interface Collection<DistanceResultPair<D extends Distance<D>>>
size
in interface List<DistanceResultPair<D extends Distance<D>>>
size
in class AbstractCollection<DistanceResultPair<D extends Distance<D>>>