Class AbstractSTRtree
- java.lang.Object
-
- org.locationtech.jts.index.strtree.AbstractSTRtree
-
- All Implemented Interfaces:
java.io.Serializable
public abstract class AbstractSTRtree extends java.lang.Object implements java.io.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
Boundable
s rather thanAbstractNode
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.
- Version:
- 1.7
- See Also:
STRtree
,SIRtree
, Serialized Form
-
-
Constructor Summary
Constructors Constructor 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 haveAbstractSTRtree(int nodeCapacity, java.util.ArrayList itemBoundables)
Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have, and all leaf nodes in the treeAbstractSTRtree(int nodeCapacity, AbstractNode root)
Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have, and the root node
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.int
getNodeCapacity()
Returns the maximum number of child nodes that a node may have.AbstractNode
getRoot()
Gets the root node of the tree.boolean
isEmpty()
Tests whether the index contains any items.java.util.List
itemsTree()
Gets a tree structure (as a nested list) corresponding to the structure of the items and nodes in this tree.
-
-
-
Constructor Detail
-
AbstractSTRtree
public AbstractSTRtree()
Constructs an AbstractSTRtree with the default node capacity.
-
AbstractSTRtree
public AbstractSTRtree(int nodeCapacity)
Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have- Parameters:
nodeCapacity
- the maximum number of child nodes in a node
-
AbstractSTRtree
public AbstractSTRtree(int nodeCapacity, AbstractNode root)
Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have, and the root node- Parameters:
nodeCapacity
- the maximum number of child nodes in a noderoot
- the root node that links to all other nodes in the tree
-
AbstractSTRtree
public AbstractSTRtree(int nodeCapacity, java.util.ArrayList itemBoundables)
Constructs an AbstractSTRtree with the specified maximum number of child nodes that a node may have, and all leaf nodes in the tree- Parameters:
nodeCapacity
- the maximum number of child nodes in a nodeitemBoundables
- the list of leaf nodes in the tree
-
-
Method Detail
-
build
public 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.
-
getRoot
public AbstractNode getRoot()
Gets the root node of the tree.- Returns:
- the root node
-
getNodeCapacity
public int getNodeCapacity()
Returns the maximum number of child nodes that a node may have.- Returns:
- the node capacity
-
isEmpty
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
-
itemsTree
public java.util.List itemsTree()
Gets a tree structure (as a nested list) corresponding to the structure of the items and nodes in this tree.The returned
List
s contain eitherObject
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
-
-