Class Searcher

java.lang.Object
  extended by Searcher
Direct Known Subclasses:
BreadthFirstSearcher, DepthFirstSearcher

public abstract class Searcher
extends java.lang.Object

Searcher.java - a superclass for AI searcher classes.


Constructor Summary
Searcher()
           
 
Method Summary
 SearchNode getGoalNode()
          getGoalNode - Returns a goal node if the previous search was successful, and null otherwise.
 int getNodeCount()
          getNodeCount - Returns the number of nodes examined (goal-checked) in the previous search.
 void printGoalPath()
          printGoalPath - If the previous search was successful, print each node along the goal path in sequence starting with the root node.
abstract  boolean search(SearchNode node)
          search - Search for a goal node starting at the given "root" SearchNode, and return whether or not a goal node was found.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Searcher

public Searcher()
Method Detail

search

public abstract boolean search(SearchNode node)
search - Search for a goal node starting at the given "root" SearchNode, and return whether or not a goal node was found.

Parameters:
node - a SearchNode value - the initial "root" search node
Returns:
a boolean value - whether or not a goal node was found

getGoalNode

public SearchNode getGoalNode()
getGoalNode - Returns a goal node if the previous search was successful, and null otherwise.

Returns:
a SearchNode value - the goal node from previous search or null if no goal node was found

getNodeCount

public int getNodeCount()
getNodeCount - Returns the number of nodes examined (goal-checked) in the previous search.

Returns:
an int value - the number of nodes checked in the previous search. This may be considerably less than the number of children generated.

printGoalPath

public void printGoalPath()
printGoalPath - If the previous search was successful, print each node along the goal path in sequence starting with the root node. Otherwise, print "Goal node not found".