public abstract class AbstractSTRtree extends Object implements Serializable
This implementation is based on Boundable
s rather than AbstractNode
s,
because the STR algorithm operates on both nodes and
data, both of which are treated as Boundables.
This class is thread-safe. Building the tree is synchronized, and querying is stateless.
STRtree
,
SIRtree
,
Serialized FormModifier and Type | Class and Description |
---|---|
protected static interface |
AbstractSTRtree.IntersectsOp
A test for intersection between two bounds, necessary because subclasses
of AbstractSTRtree have different implementations of bounds.
|
Modifier and Type | Field and Description |
---|---|
protected AbstractNode |
root |
Constructor and Description |
---|
AbstractSTRtree()
Constructs an AbstractSTRtree with the
default node capacity.
|
AbstractSTRtree(int nodeCapacity)
Constructs an AbstractSTRtree with the specified maximum number of child
nodes that a node may have
|
Modifier and Type | Method and Description |
---|---|
protected List |
boundablesAtLevel(int level) |
void |
build()
Creates parent nodes, grandparent nodes, and so forth up to the root
node, for the data that has been inserted into the tree.
|
protected static int |
compareDoubles(double a,
double b) |
protected abstract AbstractNode |
createNode(int level) |
protected List |
createParentBoundables(List childBoundables,
int newLevel)
Sorts the childBoundables then divides them into groups of size M, where
M is the node capacity.
|
protected int |
depth() |
protected int |
depth(AbstractNode node) |
protected abstract Comparator |
getComparator() |
protected abstract AbstractSTRtree.IntersectsOp |
getIntersectsOp() |
int |
getNodeCapacity()
Returns the maximum number of child nodes that a node may have
|
AbstractNode |
getRoot() |
protected void |
insert(Object bounds,
Object item) |
boolean |
isEmpty()
Tests whether the index contains any items.
|
List |
itemsTree()
Gets a tree structure (as a nested list)
corresponding to the structure of the items and nodes in this tree.
|
protected AbstractNode |
lastNode(List nodes) |
protected List |
query(Object searchBounds)
Also builds the tree, if necessary.
|
protected void |
query(Object searchBounds,
ItemVisitor visitor)
Also builds the tree, if necessary.
|
protected boolean |
remove(Object searchBounds,
Object item)
Removes an item from the tree.
|
protected int |
size() |
protected int |
size(AbstractNode node) |
protected AbstractNode root
public AbstractSTRtree()
public AbstractSTRtree(int nodeCapacity)
nodeCapacity
- the maximum number of child nodes in a nodepublic void build()
protected abstract AbstractNode createNode(int level)
protected List createParentBoundables(List childBoundables, int newLevel)
protected AbstractNode lastNode(List nodes)
protected static int compareDoubles(double a, double b)
public AbstractNode getRoot()
public int getNodeCapacity()
public boolean isEmpty()
protected int size()
protected int size(AbstractNode node)
protected int depth()
protected int depth(AbstractNode node)
protected void query(Object searchBounds, ItemVisitor visitor)
protected abstract AbstractSTRtree.IntersectsOp getIntersectsOp()
AbstractSTRtree.IntersectsOp
public List itemsTree()
The returned List
s contain either Object
items,
or Lists which correspond to subtrees of the tree
Subtrees which do not contain any items are not included.
Builds the tree if necessary.
protected boolean remove(Object searchBounds, Object item)
protected List boundablesAtLevel(int level)
protected abstract Comparator getComparator()
Copyright © 2016. All rights reserved.