Package org.tinspin.index.util
Class PointMultimapWrapper<T>
- java.lang.Object
-
- org.tinspin.index.util.PointMultimapWrapper<T>
-
- All Implemented Interfaces:
Index,PointMultimap<T>
public class PointMultimapWrapper<T> extends Object implements PointMultimap<T>
-
-
Nested Class Summary
-
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>
-
Nested classes/interfaces inherited from interface org.tinspin.index.PointMultimap
PointMultimap.Factory
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries.booleancontains(double[] point, T value)Lookup an entry, using exact match.static <T> PointMultimap<T>create(BoxMultimap<T> ind)intgetDepth()intgetDims()intgetNodeCount()StatsgetStats()voidinsert(double[] key, T value)Insert a point.Index.PointIterator<T>iterator()voidload(RTreeEntry<T>[] entries)Index.PointIterator<T>query(double[] min, double[] max)Index.PointEntryKnn<T>query1nn(double[] center)Finds the nearest neighbor.Index.PointIterator<T>queryExactPoint(double[] point)Lookup an entries at a given coordinate.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.intsize()StringtoStringTree()booleanupdate(double[] oldPoint, double[] newPoint, T value)Update the position of an entry.
-
-
-
Method Detail
-
create
public static <T> PointMultimap<T> create(BoxMultimap<T> ind)
-
iterator
public Index.PointIterator<T> iterator()
- Specified by:
iteratorin interfacePointMultimap<T>- Returns:
- An iterator over all entries.
-
query
public Index.PointIterator<T> query(double[] min, double[] max)
- Specified by:
queryin interfacePointMultimap<T>- 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
public Index.PointEntryKnn<T> query1nn(double[] center)
Description copied from interface:PointMultimapFinds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.- Specified by:
query1nnin interfacePointMultimap<T>- Parameters:
center- center point- Returns:
- the nearest neighbor
-
queryKnn
public Index.PointIteratorKnn<T> queryKnn(double[] center, int k)
Description copied from interface:PointMultimapFinds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.- Specified by:
queryKnnin interfacePointMultimap<T>- Parameters:
center- center pointk- number of neighbors- Returns:
- list of nearest neighbors
-
queryKnn
public Index.PointIteratorKnn<T> queryKnn(double[] center, int k, PointDistance distFn)
Description copied from interface:PointMultimapFinds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.- Specified by:
queryKnnin interfacePointMultimap<T>- Parameters:
center- center pointk- number of neighborsdistFn- the point distance function to be used- Returns:
- list of nearest neighbors
-
insert
public void insert(double[] key, T value)Description copied from interface:PointMultimapInsert a point.- Specified by:
insertin interfacePointMultimap<T>- Parameters:
key- pointvalue- value
-
remove
public boolean remove(double[] point, T value)Description copied from interface:PointMultimapRemove *one* entry with the given value.- Specified by:
removein interfacePointMultimap<T>- 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
public boolean removeIf(double[] point, Predicate<Index.PointEntry<T>> condition)Description copied from interface:PointMultimapRemove *one* entry with the given condition.- Specified by:
removeIfin interfacePointMultimap<T>- 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
-
queryExactPoint
public Index.PointIterator<T> queryExactPoint(double[] point)
Description copied from interface:PointMultimapLookup an entries at a given coordinate.- Specified by:
queryExactPointin interfacePointMultimap<T>- Parameters:
point- the point- Returns:
- an iterator over all entries at the given point
-
update
public boolean update(double[] oldPoint, double[] newPoint, T value)Description copied from interface:PointMultimapUpdate the position of an entry.- Specified by:
updatein interfacePointMultimap<T>- 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
public boolean contains(double[] point, T value)Description copied from interface:PointMultimapLookup an entry, using exact match.- Specified by:
containsin interfacePointMultimap<T>- Parameters:
point- the pointvalue- the value- Returns:
- `true` if an entry was found, otherwise `false`.
-
getDims
public int getDims()
-
clear
public void clear()
Description copied from interface:IndexClear all entries.
-
getStats
public Stats getStats()
-
getNodeCount
public int getNodeCount()
- Specified by:
getNodeCountin interfaceIndex
-
load
public void load(RTreeEntry<T>[] entries)
-
toStringTree
public String toStringTree()
- Specified by:
toStringTreein interfaceIndex- Returns:
- a full string output of the tree structure with all entries
-
-