Class AbstractSTRtree

Hierarchy: Object , AbstractSTRtree
All Implemented Interfaces: Serializable
Direct Known Subclasses: STRtree, SIRtree
public abstract class AbstractSTRtree
implements Serializable
Base class for STRtree and SIRtree. STR-packed R-trees are described in: P. Rigaux, Michel Scholl and Agnes Voisard. Spatial Databases With Application To GIS. Morgan Kaufmann, San Francisco, 2002.

This implementation is based on Boundables rather than AbstractNodes, 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.

See also:
STRtree
SIRtree

Other

  • version: 1.7
public AbstractSTRtree()
Constructs an AbstractSTRtree with the default node capacity.
public AbstractSTRtree(int nodeCapacity)
Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have
Parameters:
nodeCapacity - nodeCapacity the maximum number of child nodes in a node
public synchronized 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. Can only be called once, and thus can be called only after all of the data has been inserted into the tree.
protected abstract 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 AbstractNode lastNode(List nodes)
protected static int compareDoubles(double a, double b)
public AbstractNode getRoot()
Gets the root node of the tree.
Returns:
the root node
public int getNodeCapacity()
Returns the maximum number of child nodes that a node may have.
Returns:
the node capacity
public boolean isEmpty()
Tests whether the index contains any items. This method does not build the index, so items can still be inserted after it has been called.
Returns:
true if the index does not contain any items
protected int size()
protected int size(AbstractNode node)
protected int depth()
protected int depth(AbstractNode node)
protected void insert(Object bounds, Object item)
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 abstract abstract IntersectsOp getIntersectsOp()
See also:
IntersectsOp
Returns:
a test for intersection between two bounds, necessary because subclasses of AbstractSTRtree have different implementations of bounds.
public List itemsTree()
Gets a tree structure (as a nested list) corresponding to the structure of the items and nodes in this tree.

The returned Lists 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.

Returns:
a List of items and/or Lists
protected boolean remove(Object searchBounds, Object item)
Removes an item from the tree. (Builds the tree, if necessary.)
protected List boundablesAtLevel(int level)
protected abstract abstract Comparator getComparator()