Package org.tinspin.index.phtree
Class PHTreeR<T>
- java.lang.Object
-
- org.tinspin.index.phtree.PHTreeR<T>
-
- All Implemented Interfaces:
Index<T>,RectangleIndex<T>
public class PHTreeR<T> extends Object implements RectangleIndex<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries.static <T> PHTreeR<T>createPHTree(int dims)intgetDepth()intgetDims()intgetNodeCount()PHStatsgetStats()voidinsert(double[] lower, double[] upper, T value)Insert a rectangle.QueryIterator<RectangleEntry<T>>iterator()TqueryExact(double[] lower, double[] upper)Lookup an entry, using exact match.QueryIterator<RectangleEntry<T>>queryIntersect(double[] min, double[] max)QueryIteratorKNN<RectangleEntryDist<T>>queryKNN(double[] center, int k)Finds the nearest neighbor.Tremove(double[] lower, double[] upper)Remove an entry.intsize()StringtoStringTree()Tupdate(double[] lo1, double[] up1, double[] lo2, double[] up2)Update the position of an entry.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.tinspin.index.RectangleIndex
query1NN
-
-
-
-
Method Detail
-
createPHTree
public static <T> PHTreeR<T> createPHTree(int dims)
-
getDims
public int getDims()
-
clear
public void clear()
Description copied from interface:IndexClear all entries.
-
getStats
public PHStats getStats()
-
getNodeCount
public int getNodeCount()
- Specified by:
getNodeCountin interfaceIndex<T>
-
toStringTree
public String toStringTree()
- Specified by:
toStringTreein interfaceIndex<T>- Returns:
- a full string output of the tree structure with all entries
-
insert
public void insert(double[] lower, double[] upper, T value)Description copied from interface:RectangleIndexInsert a rectangle.- Specified by:
insertin interfaceRectangleIndex<T>- Parameters:
lower- minimum cornerupper- maximum cornervalue- value
-
remove
public T remove(double[] lower, double[] upper)
Description copied from interface:RectangleIndexRemove an entry.- Specified by:
removein interfaceRectangleIndex<T>- Parameters:
lower- minimum cornerupper- maximum corner- Returns:
- the value of the entry or null if the entry was not found
-
update
public T update(double[] lo1, double[] up1, double[] lo2, double[] up2)
Description copied from interface:RectangleIndexUpdate the position of an entry.- Specified by:
updatein interfaceRectangleIndex<T>- Parameters:
lo1- old minup1- old maxlo2- new minup2- new max- Returns:
- the value, or null if the entries was not found
-
queryExact
public T queryExact(double[] lower, double[] upper)
Description copied from interface:RectangleIndexLookup an entry, using exact match.- Specified by:
queryExactin interfaceRectangleIndex<T>- Parameters:
lower- minimum cornerupper- maximum corner- Returns:
- the value of the entry or null if the entry was not found
-
iterator
public QueryIterator<RectangleEntry<T>> iterator()
- Specified by:
iteratorin interfaceRectangleIndex<T>- Returns:
- An iterator over all entries.
-
queryIntersect
public QueryIterator<RectangleEntry<T>> queryIntersect(double[] min, double[] max)
- Specified by:
queryIntersectin interfaceRectangleIndex<T>- 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.
-
queryKNN
public QueryIteratorKNN<RectangleEntryDist<T>> queryKNN(double[] center, int k)
Description copied from interface:RectangleIndexFinds 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.- Specified by:
queryKNNin interfaceRectangleIndex<T>- Parameters:
center- center pointk- number of neighbors- Returns:
- list of nearest neighbors
-
-