Package org.tinspin.index.phtree
Class PHTreeP<T>
- java.lang.Object
-
- org.tinspin.index.phtree.PHTreeP<T>
-
- All Implemented Interfaces:
Index<T>,PointIndex<T>
public class PHTreeP<T> extends Object implements PointIndex<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all entries.static <T> PHTreeP<T>createPHTree(int dims)intgetDepth()intgetDims()intgetNodeCount()StatsgetStats()voidinsert(double[] key, T value)Insert a point.QueryIterator<PointEntry<T>>iterator()QueryIterator<PointEntry<T>>query(double[] min, double[] max)TqueryExact(double[] point)Lookup an entry, using exact match.QueryIteratorKNN<PointEntryDist<T>>queryKNN(double[] center, int k)Finds the nearest neighbor.Tremove(double[] point)Remove a point entry.intsize()StringtoStringTree()Tupdate(double[] oldPoint, double[] newPoint)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.PointIndex
query1NN
-
-
-
-
Method Detail
-
createPHTree
public static <T> PHTreeP<T> createPHTree(int dims)
-
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<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[] key, T value)Description copied from interface:PointIndexInsert a point.- Specified by:
insertin interfacePointIndex<T>- Parameters:
key- pointvalue- value
-
remove
public T remove(double[] point)
Description copied from interface:PointIndexRemove a point entry.- Specified by:
removein interfacePointIndex<T>- Parameters:
point- the point- Returns:
- the value of the entry or null if the entry was not found
-
update
public T update(double[] oldPoint, double[] newPoint)
Description copied from interface:PointIndexUpdate the position of an entry.- Specified by:
updatein interfacePointIndex<T>- Parameters:
oldPoint- old positionnewPoint- new position- Returns:
- the value of the entry or null if the entry was not found
-
queryExact
public T queryExact(double[] point)
Description copied from interface:PointIndexLookup an entry, using exact match.- Specified by:
queryExactin interfacePointIndex<T>- Parameters:
point- the point- Returns:
- the value of the entry or null if the entry was not found
-
query
public QueryIterator<PointEntry<T>> query(double[] min, double[] max)
- Specified by:
queryin interfacePointIndex<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.
-
iterator
public QueryIterator<PointEntry<T>> iterator()
- Specified by:
iteratorin interfacePointIndex<T>- Returns:
- An iterator over all entries.
-
queryKNN
public QueryIteratorKNN<PointEntryDist<T>> queryKNN(double[] center, int k)
Description copied from interface:PointIndexFinds the nearest neighbor. This uses euclidean distance. Other distance types can only be specified directly on the index implementations.- Specified by:
queryKNNin interfacePointIndex<T>- Parameters:
center- center pointk- number of neighbors- Returns:
- list of nearest neighbors
-
-