Package gov.nasa.worldwind.util
Class DecisionTree<T,C>
- java.lang.Object
-
- gov.nasa.worldwind.util.DecisionTree<T,C>
-
public class DecisionTree<T,C> extends java.lang.ObjectTraverses an implicit tree and makes decisions at tree nodes visited in depth-first order.Users provide an object at construction that implements the
DecisionTree.Controllerinterface. This controller provides methods to determine node inclusion, to terminate traversal, and to create descendant nodes. It is carried to each node during traversal.Users also provide a user-defined context object to carry state and other information to each node. The context can hold information to assist in decisions or to retains objects or information gathered during traversal.
At the start of traversal a user-defined object is specified as the object defining the decision. It's the object against which decisions are made at each node.
See the source code of
SectorVisibilityTreefor example usage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceDecisionTree.Controller<T,C>Interface defined by the class user to control traversal.
-
Field Summary
Fields Modifier and Type Field Description protected DecisionTree.Controller<T,C>controller
-
Constructor Summary
Constructors Constructor Description DecisionTree(DecisionTree.Controller<T,C> controller)Construct a decision tree for a given item type and controller type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidtraverse(T o, C context)Start tree traversal.
-
-
-
Field Detail
-
controller
protected DecisionTree.Controller<T,C> controller
-
-
Constructor Detail
-
DecisionTree
public DecisionTree(DecisionTree.Controller<T,C> controller)
Construct a decision tree for a given item type and controller type.- Parameters:
controller- a user-defined object implementing theControllerinterface providing the traversal control methods.
-
-