Package search
Class Nodes.SimpleTreeCostNode<S>
java.lang.Object
search.Nodes.SimpleTreeCostNode<S>
- Type Parameters:
S
- The type of the search state underlying these nodes.
- All Implemented Interfaces:
KnowsOwnCost
,SearchTreeNode<Nodes.SimpleTreeCostNode<S>,S>
- Enclosing class:
- Nodes
public static class Nodes.SimpleTreeCostNode<S> extends Object
Implementation of search tree nodes
with a notion of cost.
-
Constructor Summary
Constructors Constructor Description SimpleTreeCostNode(Function<S,Iterable<Nodes.CostAndStep<S>>> expander, double cost, S state)
Sole constructor for this class. -
Method Summary
Modifier and Type Method Description Iterable<Nodes.SimpleTreeCostNode<S>>
expand()
Expands the search node into successor nodes.double
getCost()
S
getState()
Returns the search state underlying this node.static <S> Function<S,Nodes.SimpleTreeCostNode<S>>
initializer(Function<S,Iterable<Nodes.CostAndStep<S>>> expander)
Returns a factory for tree nodes with costs, given an expander from a state to the states underlying its expanded nodes.String
toString()
Format this node as a string, typically for debugging.
-
Constructor Details
-
SimpleTreeCostNode
public SimpleTreeCostNode(Function<S,Iterable<Nodes.CostAndStep<S>>> expander, double cost, S state)Sole constructor for this class.- Parameters:
expander
- Function from a state to (cost,state)-bundles of information for the construction of expanded nodes.cost
- Cost associated with this node.state
- The state underlying this node.
-
-
Method Details
-
expand
Expands the search node into successor nodes.- Returns:
- An
Iterable
instance of the successor nodes.
-
initializer
public static final <S> Function<S,Nodes.SimpleTreeCostNode<S>> initializer(Function<S,Iterable<Nodes.CostAndStep<S>>> expander)Returns a factory for tree nodes with costs, given an expander from a state to the states underlying its expanded nodes. -
getCost
public double getCost()- Specified by:
getCost
in interfaceKnowsOwnCost
- Returns:
- The cost of reaching the state in this node.
-
toString
Format this node as a string, typically for debugging. -
getState
Returns the search state underlying this node.- Specified by:
getState
in interfaceSearchTreeNode<Self extends search.Nodes.SimpleCoreTreeNode<Self,Exp,S>,Exp>
-