Class Node<T>
java.lang.Object
puzzle.solver.Node<T>
- Type Parameters:
T
- represents the moves that can be applied to the states
Represents the nodes of a search graph.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
getMove()
Returns the move that created the state from the state of the parent node.Returns the parent of the node.getState()
Returns the state represented by the node.int
hashCode()
boolean
Returns whether the node has at least one child node to be created with thenextChild()
method.Creates and returns the next child of the node by applying a legal move to the state represented by the node.toString()
-
Constructor Details
-
Node
-
Node
-
-
Method Details
-
getState
-
getParent
-
getMove
-
hasNextChild
public boolean hasNextChild()Returns whether the node has at least one child node to be created with thenextChild()
method.- Returns:
- whether the node has at least one child node to be created with
the
nextChild()
method
-
nextChild
Creates and returns the next child of the node by applying a legal move to the state represented by the node. The move applied to the state is removed from the set of legal moves.- Returns:
- an
Optional
describing the next child of the node, or an emptyOptional
if there are no more children
-
equals
-
hashCode
-
toString
-