001    package aima.search.framework;
002    
003    import java.util.ArrayList;
004    import java.util.List;
005    
006    /**
007     * @author Ravi Mohan
008     * 
009     */
010    
011    public class SearchUtils {
012    
013            public static List<String> actionsFromNodes(List<Node> nodeList) {
014                    List<String> stateList = new ArrayList<String>();
015                    for (int i = 1; i < nodeList.size(); i++) { // ignore root node this has
016                            // no action hence index starts from 1 not
017                            // zero
018                            Node node = nodeList.get(i);
019                            stateList.add(node.getAction());
020                    }
021                    return stateList;
022            }
023    
024            public static List<String> stringToList(String str) {
025    
026                    List<String> list = new ArrayList<String>();
027                    list.add(str);
028                    return list;
029    
030            }
031    
032            public static boolean listMatches(List list, String string) {
033                    return ((list.size() == 1) && (((String) list.get(0)).equals(string)));
034            }
035    
036    }