Package org.tinspin.index
Interface PointMap<T>
-
- Type Parameters:
T- Type of the value associated with the point key.
- All Superinterfaces:
Index
- All Known Implementing Classes:
CoverTree,KDTree,PHTreeP,PointArray,PointMapWrapper,QuadTreeKD,QuadTreeKD0,QuadTreeKD2
public interface PointMap<T> extends Index
A common interface for spatial indexes (maps) that use points as keys. This interface is somewhat inconsistent because it suggests that implementations act as "maps" which means that a given keys can exist only once and is overwritten when a new entry with the same key is added.However, most implementations in this library (except for the PH-Tree) act as multimaps which means they allow multiple entries with identical keys.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfacePointMap.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)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.TqueryExact(double[] point)Lookup an entry, using exact match.Index.PointIteratorKnn<T>queryKnn(double[] center, int k)Finds the nearest neighbor.Tremove(double[] point)Remove a point entry.Tupdate(double[] oldPoint, double[] newPoint)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
T remove(double[] point)
Remove a point entry.- Parameters:
point- the point- Returns:
- the value of the entry or null if the entry was not found
-
update
T update(double[] oldPoint, double[] newPoint)
Update the position of an entry.- Parameters:
oldPoint- old positionnewPoint- new position- Returns:
- the value of the entry or null if the entry was not found
-
contains
boolean contains(double[] point)
Lookup an entry, using exact match.- Parameters:
point- the point- Returns:
- `true` if an entry was found, otherwise `false`.
-
queryExact
T queryExact(double[] point)
Lookup an entry, using exact match.- Parameters:
point- the point- Returns:
- the value of the entry or null if the entry was not found
-
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
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
-
-