Package org.tinspin.index
Interface RectangleIndexMM<T>
-
- Type Parameters:
T- Type of the value associated with the rectangles key.
- All Superinterfaces:
Index<T>
- All Known Implementing Classes:
QuadTreeRKD,QuadTreeRKD0,RectArray,RTree
public interface RectangleIndexMM<T> extends Index<T>
A common interface for spatial indexes (multimaps) that use rectangles as keys. This interface requires indexes to be multimaps which mean a given keys can exist multiple times and is not overwritten when a new entry with the same key is added.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancontains(double[] lower, double[] upper, T value)Lookup an entry, using exact match.voidinsert(double[] lower, double[] upper, T value)Insert a rectangle.QueryIterator<RectangleEntry<T>>iterator()default RectangleEntryDist<T>query1NN(double[] center)Finds the nearest neighbor.QueryIterator<RectangleEntry<T>>queryIntersect(double[] min, double[] max)QueryIteratorKNN<RectangleEntryDist<T>>queryKNN(double[] center, int k)Finds the nearest neighbor.QueryIteratorKNN<RectangleEntryDist<T>>queryKNN(double[] center, int k, RectangleDistanceFunction distFn)Finds the nearest neighbor.QueryIterator<RectangleEntry<T>>queryRectangle(double[] lower, double[] upper)Lookup an entry, using exact match.booleanremove(double[] lower, double[] upper, T value)Remove *one*n entry with the given value.booleanremoveIf(double[] lower, double[] upper, Predicate<RectangleEntry<T>> condition)Remove *one* entry with the given condition.booleanupdate(double[] lo1, double[] up1, double[] lo2, double[] up2, T value)Update the position of an entry.-
Methods inherited from interface org.tinspin.index.Index
clear, getDepth, getDims, getNodeCount, getStats, size, toStringTree
-
-
-
-
Method Detail
-
insert
void insert(double[] lower, double[] upper, T value)Insert a rectangle.- Parameters:
lower- minimum cornerupper- maximum cornervalue- value
-
remove
boolean remove(double[] lower, double[] upper, T value)Remove *one*n entry with the given value.- Parameters:
lower- minimum cornerupper- maximum cornervalue- value- Returns:
- the value of the entry or null if the entry was not found
-
removeIf
boolean removeIf(double[] lower, double[] upper, Predicate<RectangleEntry<T>> condition)Remove *one* entry with the given condition.- Parameters:
lower- minimum cornerupper- maximum cornercondition- the condition required for removing an entry- Returns:
- the value of the entry or null if the entry was not found
-
update
boolean update(double[] lo1, double[] up1, double[] lo2, double[] up2, T value)Update the position of an entry.- Parameters:
lo1- old minup1- old maxlo2- new minup2- new maxvalue- only entries with this value are updated- Returns:
- the value, or null if the entries was not found
-
contains
boolean contains(double[] lower, double[] upper, T value)Lookup an entry, using exact match.- Parameters:
lower- minimum cornerupper- maximum cornervalue- the value- Returns:
- `true` if an entry was found, otherwise `false`.
-
queryRectangle
QueryIterator<RectangleEntry<T>> queryRectangle(double[] lower, double[] upper)
Lookup an entry, using exact match.- Parameters:
lower- minimum cornerupper- maximum corner- Returns:
- an iterator over all entries at with the exact given rectangle
-
iterator
QueryIterator<RectangleEntry<T>> iterator()
- Returns:
- An iterator over all entries.
-
queryIntersect
QueryIterator<RectangleEntry<T>> queryIntersect(double[] min, double[] max)
- Parameters:
min- Lower left corner of the query windowmax- Upper right corner of the query window- Returns:
- All rectangles that intersect with the query rectangle.
-
query1NN
default RectangleEntryDist<T> query1NN(double[] center)
Finds the nearest neighbor. This uses Euclidean 'edge distance'. Other distance types can only be specified directly on the index implementations.- Parameters:
center- center point- Returns:
- the nearest neighbor
-
queryKNN
QueryIteratorKNN<RectangleEntryDist<T>> queryKNN(double[] center, int k)
Finds the nearest neighbor. This uses Euclidean 'edge distance', i.e. the distance to the edge of rectangle. Distance is 0 is the rectangle overlaps with the search point. Other distance types can only be specified directly on the index implementations.- Parameters:
center- center pointk- number of neighbors- Returns:
- list of nearest neighbors
-
queryKNN
QueryIteratorKNN<RectangleEntryDist<T>> queryKNN(double[] center, int k, RectangleDistanceFunction distFn)
Finds the nearest neighbor. This uses a custom distance function for distances to rectangles.- Parameters:
center- center pointk- number of neighborsdistFn- distance function- Returns:
- list of nearest neighbors
-
-