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)
CoordinateIndex
insert
in interface CoordinateIndex<T extends Coordinate>
point
- coordinate to add.public void rangeSearch(Collection<T> results, Coordinate lowerExtreme, Coordinate upperExtreme)
CoordinateIndex
rangeSearch
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)
CoordinateIndex
nearestNeighbour
in interface CoordinateIndex<T extends Coordinate>
query
- The query coordinate.public void kNearestNeighbour(Collection<T> result, Coordinate query, int k)
CoordinateIndex
kNearestNeighbour
in interface CoordinateIndex<T extends Coordinate>
result
- Collection to hold the found coordinates.query
- The query coordinate.k
- The number of neighbours to find.