-
Notifications
You must be signed in to change notification settings - Fork 0
/
NodeExpander.java
46 lines (30 loc) · 914 Bytes
/
NodeExpander.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import java.util.ArrayList;
import java.util.List;
import components.set.Set;
/**
* @author greedywind / James Archer
*
*/
public class NodeExpander extends TransitionModel {
/**
* Returns the children obtained from expanding the specified node in the
* specified problem.
*
* @param node
* the node to expand
* @param problem
* the problem the specified node is within.
*
* @return the children obtained from expanding the specified node in the
* specified problem.
*/
public final List<Node> expandNode(Node node) {
List<Node> childNodes = new ArrayList<Node>();
Set<String> states=SuccessorStates(node.getState(),ActionSet());
for (String successorState : states) {
int stepCost =1;
childNodes.add(new Node(successorState, node, stepCost));
}
return childNodes;
}
}