|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectNode
This is the class for representing a single search node. Such a node consists of a State representing the actual configuration of the puzzle, as well as the depth of the search node from the initial state, and the parent node of the current node in the search tree, i.e., the node from which this node was expanded. Thus, the path from the initial node to this node can be computed by tracing backward using the parent links. (The parent of the initial node is set to null.) The total distance from the initial node is equal to the depth of this node.
Constructor Summary | |
Node(State state,
int depth,
Node parent)
The main constructor for constructing a search node. |
Method Summary | |
Node[] |
expand()
Expands this node, in other words, computes all of the nodes immediately reachable from this node according to the rules of the puzzle and returns them as an array of nodes. |
int |
getDepth()
Returns the depth of this node. |
Node |
getParent()
Returns this node's parent node. |
State |
getState()
Returns the state associated with this node. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Node(State state, int depth, Node parent)
state
- the state that resides at this nodedepth
- the search depth of this nodeparent
- the parent of this nodeMethod Detail |
public State getState()
public Node getParent()
public int getDepth()
public Node[] expand()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |