Interface BSPSubtree<P extends Point<P>,N extends BSPTree.Node<P,N>>
- Type Parameters:
P
- Point implementation typeN
- Node implementation type
- All Known Subinterfaces:
BSPTree<P,
,N> BSPTree.Node<P,
N>
- All Known Implementing Classes:
AbstractBSPTree
,AbstractBSPTree.AbstractNode
,AbstractRegionBSPTree
,AbstractRegionBSPTree.AbstractRegionNode
,RegionBSPTree1D
,RegionBSPTree1D.RegionNode1D
,RegionBSPTree1S
,RegionBSPTree1S.RegionNode1S
,RegionBSPTree2D
,RegionBSPTree2D.RegionNode2D
,RegionBSPTree2S
,RegionBSPTree2S.RegionNode2S
,RegionBSPTree3D
,RegionBSPTree3D.RegionNode3D
public interface BSPSubtree<P extends Point<P>,N extends BSPTree.Node<P,N>>
Interface for types that form the root of BSP subtrees. This includes trees
themselves as well as each node in a tree.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(BSPTreeVisitor<P, N> visitor) Accept a visitor instance, calling it with each node from the subtree.int
count()
Return the total number of nodes in the subtree.int
height()
The height of the subtree, ie the length of the longest downward path from the subtree root to a leaf node.nodes()
Get an iterable for accessing the nodes in this subtree.
-
Method Details
-
count
int count()Return the total number of nodes in the subtree.- Returns:
- the total number of nodes in the subtree.
-
height
int height()The height of the subtree, ie the length of the longest downward path from the subtree root to a leaf node. A leaf node has a height of 0.- Returns:
- the height of the subtree.
-
accept
Accept a visitor instance, calling it with each node from the subtree.- Parameters:
visitor
- visitor called with each subtree node
-
nodes
Get an iterable for accessing the nodes in this subtree. This provides a simple alternative toaccept(BSPTreeVisitor)
for accessing tree nodes but is not as powerful or flexible since the node iteration order is fixed.- Returns:
- an iterable for accessing the nodes in this subtree
-