K
- the type of keys.V
- the type of associated objects.public class Neighbor<K,V> extends java.lang.Object implements java.lang.Comparable<Neighbor<K,V>>
Modifier and Type | Field and Description |
---|---|
double |
distance
The distance between the query and the neighbor.
|
int |
index
The index of neighbor object in the dataset.
|
K |
key
The key of neighbor.
|
V |
value
The data object of neighbor.
|
Constructor and Description |
---|
Neighbor(K key,
V object,
int index,
double distance)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Neighbor<K,V> o) |
static <T> Neighbor<T,T> |
of(T key,
int index,
double distance)
Creates a neighbor object, of which key and object are the same.
|
java.lang.String |
toString() |
public final K key
public final V value
public final int index
public final double distance