Package search
Class Nodes.SimpleTreePathNode<S>
java.lang.Object
search.Nodes.SimpleTreePathNode<S>
- Type Parameters:
S
- The type of the search state underlying these nodes.
- All Implemented Interfaces:
SearchTreeNode<Nodes.SimpleTreePathNode<S>,S>
,SearchTreePathNode<Nodes.SimpleTreePathNode<S>,S>
- Enclosing class:
- Nodes
public static class Nodes.SimpleTreePathNode<S> extends Object
Implementation of search tree nodes
which retain a link to their parent.
-
Constructor Summary
Constructors Constructor Description SimpleTreePathNode(Function<S,Iterable<S>> expander, S state)
SimpleTreePathNode(Nodes.SimpleTreePathNode<S> parent, S state)
-
Method Summary
Modifier and Type Method Description Iterable<Nodes.SimpleTreePathNode<S>>
expand()
Expands the search node into successor nodes.Nodes.SimpleTreePathNode<S>
getParent()
Returns the node from which this node was expanded.S
getState()
Returns the search state underlying this node.static <S> Function<S,Nodes.SimpleTreePathNode<S>>
initializer(Function<S,Iterable<S>> expander)
Returns a factory for parent-tracking tree nodes, given an expander from a state to the states underlying expanded nodes.String
toString()
Format this node as a string, typically for debugging.
-
Constructor Details
-
SimpleTreePathNode
- Parameters:
expander
- Function from a state to (cost,state)-bundles of information for the construction of expanded nodes.state
- The state underlying this node.
-
SimpleTreePathNode
- Parameters:
parent
- The parent of 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.SimpleTreePathNode<S>> initializer(Function<S,Iterable<S>> expander)Returns a factory for parent-tracking tree nodes, given an expander from a state to the states underlying expanded nodes. -
getParent
Returns the node from which this node was expanded.- Specified by:
getParent
in interfaceSearchTreePathNode<Self extends search.Nodes.SimpleCoreTreePathNode<Self,Exp,S>,Exp>
- Returns:
null
if this is the initial 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>
-