T - the type of Coordinatepublic class CoordinateBruteForce<T extends Coordinate> extends Object implements CoordinateIndex<T>
CoordinateIndex that performs
searching by brute-force comparison over the indexed coordinates.| Constructor and Description |
|---|
CoordinateBruteForce()
Default constructor.
|
CoordinateBruteForce(List<T> data)
Construct the index and populate it with the given data.
|
| Modifier and Type | Method and Description |
|---|---|
void |
insert(T point)
Insert a single coordinate into the index.
|
void |
kNearestNeighbour(Collection<T> result,
Coordinate query,
int k)
Find the k nearest neighbour points in the index to
the query coordinate.
|
T |
nearestNeighbour(Coordinate query)
Find the nearest coordinate in the index to the query
coordinate.
|
void |
rangeSearch(Collection<T> results,
Coordinate lowerExtreme,
Coordinate upperExtreme)
Search for all the coordinates in the index that
lie in the hyper-rectangle defined by the lower and
upper bound coordinates.
|
public CoordinateBruteForce()
public CoordinateBruteForce(List<T> data)
data - the data to add to the index.public void insert(T point)
CoordinateIndexinsert in interface CoordinateIndex<T extends Coordinate>point - coordinate to add.public void rangeSearch(Collection<T> results, Coordinate lowerExtreme, Coordinate upperExtreme)
CoordinateIndexrangeSearch in interface CoordinateIndex<T extends Coordinate>results - Collection to hold the found coordinates.lowerExtreme - Lower bound of the hyper-rectangle.upperExtreme - Upper bound of the hyper-rectangle.public T nearestNeighbour(Coordinate query)
CoordinateIndexnearestNeighbour in interface CoordinateIndex<T extends Coordinate>query - The query coordinate.public void kNearestNeighbour(Collection<T> result, Coordinate query, int k)
CoordinateIndexkNearestNeighbour in interface CoordinateIndex<T extends Coordinate>result - Collection to hold the found coordinates.query - The query coordinate.k - The number of neighbours to find.