|
|
|||||||||||||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.lmu.ifi.dbs.elki.data.KNNList<D>
D
- Distance classpublic class KNNList<D extends Distance<D>>
A wrapper class for storing the k most similar comparable objects.
Field Summary | |
---|---|
private D |
infiniteDistance
The infinite distance. |
private int |
k
The maximum size of this list. |
private SortedSet<DistanceResultPair<D>> |
list
The underlying set. |
Constructor Summary | |
---|---|
KNNList(int k,
D infiniteDistance)
Creates a new KNNList with the specified parameters. |
Method Summary | |
---|---|
boolean |
add(DistanceResultPair<D> o)
Adds a new object to this list. |
List<D> |
distancesToList()
Return a list containing just the distances |
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one. |
int |
getK()
Returns the maximum size of this list. |
D |
getKNNDistance()
Returns the k-th distance of this list (e.g. the key of the k-th element). |
D |
getMaximumDistance()
Returns the maximum distance of this list (e.g. the key of the last element). |
int |
hashCode()
Combine list hash code with the value of k. |
List<Integer> |
idsToList()
Return a list containing only the object IDs |
int |
size()
Returns the current size of this list. |
List<DistanceResultPair<D>> |
toList()
Returns a list representation of this KList. |
String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private SortedSet<DistanceResultPair<D extends Distance<D>>> list
private int k
private D extends Distance<D> infiniteDistance
Constructor Detail |
---|
public KNNList(int k, D infiniteDistance)
k
- the number k of objects to be storedinfiniteDistance
- the infinite distanceMethod Detail |
---|
public boolean add(DistanceResultPair<D> o)
o
- the object to be added
public D getKNNDistance()
public D getMaximumDistance()
public List<DistanceResultPair<D>> toList()
public List<D> distancesToList()
public List<Integer> idsToList()
public int size()
public int getK()
public String toString()
toString
in class Object
public boolean equals(Object o)
equals
in class Object
o
- the reference object with which to compare.
true
if this object is the same as the obj argument;
false
otherwise.public int hashCode()
hashCode
in class Object
Object.hashCode()
|
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |