Class RStarTree<T extends RNode>
- java.lang.Object
-
- java.util.AbstractCollection<T>
-
- oracle.spatial.geometry.AbstractRTree<T>
-
- oracle.spatial.geometry.RStarTree<T>
-
- Type Parameters:
T
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Iterable<T>
,java.util.Collection<T>
,RTreeInterface<T>
public class RStarTree<T extends RNode> extends AbstractRTree<T> implements RTreeInterface<T>, java.io.Serializable
TODO Must work for arbitrary dimension --- check that there's no 2D-specific stuff! An in-memory implementation of R*-tree.All items must have the same dimension.
Only leaf nodes may be inserted.
- Since:
- 12.2
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class oracle.spatial.geometry.AbstractRTree
AbstractRTree.DoubleRNode, AbstractRTree.JoinWalker<T extends RNode,Q extends RNode>, AbstractRTree.JoinWalkerLevel<T extends RNode,Q extends RNode>, AbstractRTree.PairDebug<P,Q>, AbstractRTree.PQItem, AbstractRTree.TreeWalker<Q extends RNode>
-
-
Field Summary
Fields Modifier and Type Field Description protected long
assessSplitsCalls
protected long
nodesOverflowed
protected long
nodesReinserted
protected long
nodesReinsertedSame
protected long
nodesSplit
protected long
rootReinserts
protected long
rootSplits
-
Fields inherited from class oracle.spatial.geometry.AbstractRTree
modCount, nodesReturned, nodesVisited
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(T node)
Insert a new node into an RTree.oracle.spatial.geometry.RStarTree.RStarInternal
getRoot()
java.util.Iterator<T>
iterator()
boolean
remove(java.lang.Object obj)
boolean
removeIf(java.util.function.Predicate<? super Mer> merFilter, java.util.function.Predicate<? super T> filter)
Remove all nodes for which merFilter and filter are both true.int
size()
Gives the size of the tree.-
Methods inherited from class oracle.spatial.geometry.AbstractRTree
contains, containsAll, forEach, isEmpty, join, search, search, searchMer, searchNearest, searchNearest
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Methods inherited from interface oracle.spatial.geometry.RTreeInterface
forEach, forEach, join, join, join, removeIf, search, search, search, searchMer, searchMer, searchNearest, searchNearest, searchNearest
-
-
-
-
Field Detail
-
rootReinserts
protected long rootReinserts
-
rootSplits
protected long rootSplits
-
nodesReinserted
protected long nodesReinserted
-
nodesReinsertedSame
protected long nodesReinsertedSame
-
nodesSplit
protected long nodesSplit
-
nodesOverflowed
protected long nodesOverflowed
-
assessSplitsCalls
protected long assessSplitsCalls
-
-
Method Detail
-
size
public int size()
Description copied from interface:RTreeInterface
Gives the size of the tree.
-
getRoot
public oracle.spatial.geometry.RStarTree.RStarInternal getRoot()
- Specified by:
getRoot
in classAbstractRTree<T extends RNode>
-
add
public boolean add(T node) throws java.lang.UnsupportedOperationException
Description copied from interface:RTreeInterface
Insert a new node into an RTree.Note that node.getMer() will be called repeatedly during RTree operations and should be efficient, typically implemented by the node caching a Mer which it returns on each call.
node.isData() must return true.
- Specified by:
add
in interfacejava.util.Collection<T extends RNode>
- Specified by:
add
in interfaceRTreeInterface<T extends RNode>
- Overrides:
add
in classjava.util.AbstractCollection<T extends RNode>
- Parameters:
node
- the node to insert- Throws:
java.lang.UnsupportedOperationException
- if the tree does not support insertions
-
remove
public boolean remove(java.lang.Object obj) throws java.lang.UnsupportedOperationException, java.util.NoSuchElementException
-
iterator
public java.util.Iterator<T> iterator()
-
removeIf
public boolean removeIf(java.util.function.Predicate<? super Mer> merFilter, java.util.function.Predicate<? super T> filter) throws java.lang.UnsupportedOperationException
Description copied from interface:RTreeInterface
Remove all nodes for which merFilter and filter are both true. The merFilter is used to reduce the search space. See note on merFilter in the javadoc for this interface. There are no restrictions on the tests done by filter, as it is only applied to the data nodes.Most users should instead use the simpler removeIf(Mer, Predicate).
For example, if tree is an
RTree<JGeometry>
, we could remove all geometries smaller than 1000 m^2 that are completely contained in the Western hemisphere:Mer westHemi = new Mer(2); westHemi.extend(-180, -90); westHemi.extend( 0, +90); tree.removeIf(x -> westHemi.interacts(x), x -> westHemi.covers(x) && x.area(0.001) < 1000);
Note thatwestHemi.covers(x)
violates the merFilter requirements and must be put in the filter predicate instead.- Specified by:
removeIf
in interfaceRTreeInterface<T extends RNode>
- Parameters:
merFilter
- restricts the search areafilter
- the test for determining whether to remove a node- Returns:
- true if any elements were removed
- Throws:
java.lang.UnsupportedOperationException
- if remove is not supported
-
-