Package org.tinspin.index
Interface BoxMultimap<T>
-
- Type Parameters:
T- Type of the value associated with the boxes key.
- All Superinterfaces:
Index
- All Known Implementing Classes:
QuadTreeRKD,QuadTreeRKD0,RectArray,RTree
public interface BoxMultimap<T> extends Index
A common interface for spatial indexes (multimaps) that use boxes 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceBoxMultimap.Factory-
Nested classes/interfaces inherited from interface org.tinspin.index.Index
Index.BEComparator, Index.BoxEntry<T>, Index.BoxEntryKnn<T>, Index.BoxFilterKnn<T>, Index.BoxIterator<T>, Index.BoxIteratorKnn<T>, Index.PEComparator, Index.PointEntry<T>, Index.PointEntryKnn<T>, Index.PointFilterKnn<T>, Index.PointIterator<T>, Index.PointIteratorKnn<T>, Index.QueryIterator<T>, Index.QueryIteratorKnn<T>
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleancontains(double[] min, double[] max, T value)Lookup an entry, using exact match.voidinsert(double[] min, double[] max, T value)Insert a box.Index.BoxIterator<T>iterator()default Index.BoxEntryKnn<T>query1nn(double[] center)Finds the nearest neighbor.Index.BoxIterator<T>queryExactBox(double[] min, double[] max)Lookup an entry, using exact match.Index.BoxIterator<T>queryIntersect(double[] min, double[] max)Index.BoxIteratorKnn<T>queryKnn(double[] center, int k)Finds the nearest neighbor.Index.BoxIteratorKnn<T>queryKnn(double[] center, int k, BoxDistance distFn)Finds the nearest neighbor.booleanremove(double[] min, double[] max, T value)Remove *one*n entry with the given value.booleanremoveIf(double[] min, double[] max, Predicate<Index.BoxEntry<T>> condition)Remove *one* entry with the given condition.booleanupdate(double[] minOld, double[] maxOld, double[] minNew, double[] maxNew, 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[] min, double[] max, T value)Insert a box.- Parameters:
min- minimum cornermax- maximum cornervalue- value
-
remove
boolean remove(double[] min, double[] max, T value)Remove *one*n entry with the given value.- Parameters:
min- minimum cornermax- maximum cornervalue- value- Returns:
- the value of the entry or null if the entry was not found
-
removeIf
boolean removeIf(double[] min, double[] max, Predicate<Index.BoxEntry<T>> condition)Remove *one* entry with the given condition.- Parameters:
min- minimum cornermax- 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[] minOld, double[] maxOld, double[] minNew, double[] maxNew, T value)Update the position of an entry.- Parameters:
minOld- old minmaxOld- old maxminNew- new minmaxNew- new maxvalue- only entries with this value are updated- Returns:
- the value, or null if the entries was not found
-
contains
boolean contains(double[] min, double[] max, T value)Lookup an entry, using exact match.- Parameters:
min- minimum cornermax- maximum cornervalue- the value- Returns:
- `true` if an entry was found, otherwise `false`.
-
queryExactBox
Index.BoxIterator<T> queryExactBox(double[] min, double[] max)
Lookup an entry, using exact match.- Parameters:
min- minimum cornermax- maximum corner- Returns:
- an iterator over all entries with the exact given box shape
-
iterator
Index.BoxIterator<T> iterator()
- Returns:
- An iterator over all entries.
-
queryIntersect
Index.BoxIterator<T> queryIntersect(double[] min, double[] max)
- Parameters:
min- Lower left corner of the query windowmax- Upper right corner of the query window- Returns:
- All boxes that intersect with the query rectangle.
-
query1nn
default Index.BoxEntryKnn<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
Index.BoxIteratorKnn<T> queryKnn(double[] center, int k)
Finds the nearest neighbor. This uses Euclidean 'edge distance', i.e. the distance to the edge of a box. Distance is 0 if the box 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
Index.BoxIteratorKnn<T> queryKnn(double[] center, int k, BoxDistance distFn)
Finds the nearest neighbor. This uses a custom distance function for distances to boxes.- Parameters:
center- center pointk- number of neighborsdistFn- distance function- Returns:
- list of nearest neighbors
-
-