Package org.tinspin.index
Interface PointMultimap<T>
-
- Type Parameters:
T- Type of the value associated with the point key.
- All Superinterfaces:
Index
- All Known Implementing Classes:
KDTree,PHTreeMMP,PointArray,PointMultimapWrapper,QuadTreeKD,QuadTreeKD0,QuadTreeKD2
public interface PointMultimap<T> extends Index
A common interface for spatial indexes (multimaps) that use points 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 interfacePointMultimap.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[] point, T value)Lookup an entry, using exact match.voidinsert(double[] key, T value)Insert a point.Index.PointIterator<T>iterator()Index.PointIterator<T>query(double[] min, double[] max)default Index.PointEntryKnn<T>query1nn(double[] center)Finds the nearest neighbor.Index.PointIterator<T>queryExactPoint(double[] point)Lookup an entries at a given coordinate.default Index.PointIteratorKnn<T>queryKnn(double[] center, int k)Finds the nearest neighbor.Index.PointIteratorKnn<T>queryKnn(double[] center, int k, PointDistance distFn)Finds the nearest neighbor.booleanremove(double[] point, T value)Remove *one* entry with the given value.booleanremoveIf(double[] point, Predicate<Index.PointEntry<T>> condition)Remove *one* entry with the given condition.booleanupdate(double[] oldPoint, double[] newPoint, 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[] key, T value)Insert a point.- Parameters:
key- pointvalue- value
-
remove
boolean remove(double[] point, T value)Remove *one* entry with the given value.- Parameters:
point- the pointvalue- only entries with this value are removed- Returns:
- the value of the entry or null if the entry was not found
-
removeIf
boolean removeIf(double[] point, Predicate<Index.PointEntry<T>> condition)Remove *one* entry with the given condition.- Parameters:
point- the pointcondition- 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[] oldPoint, double[] newPoint, T value)Update the position of an entry.- Parameters:
oldPoint- old positionnewPoint- new positionvalue- only entries with this value are updated- Returns:
- the value of the entry or null if the entry was not found
-
contains
boolean contains(double[] point, T value)Lookup an entry, using exact match.- Parameters:
point- the pointvalue- the value- Returns:
- `true` if an entry was found, otherwise `false`.
-
queryExactPoint
Index.PointIterator<T> queryExactPoint(double[] point)
Lookup an entries at a given coordinate.- Parameters:
point- the point- Returns:
- an iterator over all entries at the given point
-
iterator
Index.PointIterator<T> iterator()
- Returns:
- An iterator over all entries.
-
query
Index.PointIterator<T> query(double[] min, double[] max)
- Parameters:
min- Lower left corner of the query windowmax- Upper right corner of the query window- Returns:
- All points that lie inside the query rectangle.
-
query1nn
default Index.PointEntryKnn<T> query1nn(double[] center)
Finds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.- Parameters:
center- center point- Returns:
- the nearest neighbor
-
queryKnn
default Index.PointIteratorKnn<T> queryKnn(double[] center, int k)
Finds the nearest neighbor. This uses Euclidean distance. 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.PointIteratorKnn<T> queryKnn(double[] center, int k, PointDistance distFn)
Finds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.- Parameters:
center- center pointk- number of neighborsdistFn- the point distance function to be used- Returns:
- list of nearest neighbors
-
-