T - Value type.public class RTree<T> extends Object implements RectangleIndex<T>
| Modifier and Type | Class and Description |
|---|---|
static class |
RTree.RTreeStats |
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG |
| Modifier | Constructor and Description |
|---|---|
protected |
RTree(int dims)
Create an RTree.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all entries.
|
static <T> RTree<T> |
createRStar(int dims) |
int |
getDepth() |
int |
getDims() |
int |
getNodeCount() |
protected org.tinspin.index.rtree.RTreeNode<T> |
getRoot() |
RTree.RTreeStats |
getStats() |
void |
insert(double[] keyMin,
double[] keyMax,
T value)
Insert a rectangle.
|
void |
insert(double[] point,
T value) |
void |
insert(Entry<T> e)
Insert an entry.
|
RTreeIterator<T> |
iterator() |
void |
load(Entry<T>[] entries) |
RectangleEntryDist<T> |
query1NN(double[] center)
Finds the nearest neighbor.
|
T |
queryExact(double[] min,
double[] max)
Lookup an entry, using exact match.
|
RTreeIterator<T> |
queryIntersect(double[] min,
double[] max) |
RTreeQueryKnn<T> |
queryKNN(double[] center,
int k)
Finds the nearest neighbor.
|
RTreeQueryKnn<T> |
queryKNN(double[] center,
int k,
RectangleDistanceFunction dist) |
Iterable<RectangleEntryDist<T>> |
queryRangedNearestNeighbor(double[] center,
RectangleDistanceFunction dist,
RectangleDistanceFunction closestDist,
double[] minBound,
double[] maxBound) |
Iterable<RectangleEntryDist<T>> |
queryRangedNearestNeighbor(double[] center,
RectangleDistanceFunction dist,
RectangleDistanceFunction closestDist,
Filter filter)
This methods returns an Iterable which returns the nodes by a combined range and
nearest number search.
|
Object |
remove(double[] point) |
T |
remove(double[] min,
double[] max)
Remove an entry.
|
int |
size() |
String |
toString() |
String |
toStringTree() |
T |
update(double[] lo1,
double[] up1,
double[] lo2,
double[] up2)
Update the position of an entry.
|
public static final boolean DEBUG
protected RTree(int dims)
dims - dimensionalitypublic static <T> RTree<T> createRStar(int dims)
public int getDims()
public void clear()
Indexpublic void insert(double[] point,
T value)
public void insert(double[] keyMin,
double[] keyMax,
T value)
insert in interface RectangleIndex<T>keyMin - minkeyMax - maxvalue - valuepublic Object remove(double[] point)
public T remove(double[] min, double[] max)
remove in interface RectangleIndex<T>min - minmax - maxpublic T update(double[] lo1, double[] up1, double[] lo2, double[] up2)
update in interface RectangleIndex<T>lo1 - old minup1 - old maxlo2 - new minup2 - new maxpublic T queryExact(double[] min, double[] max)
RectangleIndexqueryExact in interface RectangleIndex<T>min - minimum cornermax - maximum cornerpublic RTreeIterator<T> iterator()
iterator in interface RectangleIndex<T>public RTreeIterator<T> queryIntersect(double[] min, double[] max)
queryIntersect in interface RectangleIndex<T>min - Lower left corner of the query windowmax - Upper right corner of the query windowpublic RectangleEntryDist<T> query1NN(double[] center)
RectangleIndexquery1NN in interface RectangleIndex<T>center - center pointpublic RTreeQueryKnn<T> queryKNN(double[] center, int k)
RectangleIndexqueryKNN in interface RectangleIndex<T>center - center pointk - number of neighborspublic RTreeQueryKnn<T> queryKNN(double[] center, int k, RectangleDistanceFunction dist)
public Iterable<RectangleEntryDist<T>> queryRangedNearestNeighbor(double[] center, RectangleDistanceFunction dist, RectangleDistanceFunction closestDist, double[] minBound, double[] maxBound)
public Iterable<RectangleEntryDist<T>> queryRangedNearestNeighbor(double[] center, RectangleDistanceFunction dist, RectangleDistanceFunction closestDist, Filter filter)
Iterator.remove() method.center - Target position passed as parameter to the distance functions.
Can be null if your distance function supports
it (like RectangleDistanceFunction.RectangleDist).dist - Distance function used to compare entries
(example: RectangleDistanceFunction.EDGE or RectangleDistanceFunction.CENTER)closestDist - Distance of the best point in a given rectangle
(example: RectangleDistanceFunction.EDGE but *not* RectangleDistanceFunction.CENTER)filter - Filter to limit the results for range queries
(example: new Filter.RectangleIntersectFilter(min, max))public String toStringTree()
toStringTree in interface Index<T>public RTree.RTreeStats getStats()
public int getNodeCount()
getNodeCount in interface Index<T>protected org.tinspin.index.rtree.RTreeNode<T> getRoot()
Copyright © 2018. All rights reserved.