Savarese Software Research Corporation

com.savarese.spatial
Interface NearestNeighbors.Entry<Coord extends java.lang.Number & java.lang.Comparable<? super Coord>,P extends Point<Coord>,V>

Enclosing class:
NearestNeighbors<Coord extends java.lang.Number & java.lang.Comparable<? super Coord>,P extends Point<Coord>,V>

public static interface NearestNeighbors.Entry<Coord extends java.lang.Number & java.lang.Comparable<? super Coord>,P extends Point<Coord>,V>

The Entry interface makes accessible the results of a NearestNeighbors search. An Entry exposes both the point-value mapping and its distance from the query point.


Method Summary
 double getDistance()
          Returns the distance from result to the query point.
 double getDistance2()
          Returns the square of the distance from result to the query point.
 java.util.Map.Entry<P,V> getNeighbor()
          Returns the point-value mapping stored in this query result.
 

Method Detail

getDistance

double getDistance()
Returns the distance from result to the query point. This will usually be implemented by dynamically taking the square root of getDistance2(). Therefore, repeated calls may be expensive.

Returns:
The distance from result to the query point.

getDistance2

double getDistance2()
Returns the square of the distance from result to the query point. This will usually be implemented as returning a cached value used during the nearest neighbors search.

Returns:
The square of the distance from result to the query point.

getNeighbor

java.util.Map.Entry<P,V> getNeighbor()
Returns the point-value mapping stored in this query result.

Returns:
The point-value mapping stored in this query result.

Savarese Software Research Corporation

Copyright © 2001-2005 Daniel F. Savarese
Copyright © 2006-2010 Savarese Software Research Corporation