Class SearchApplet

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----java.applet.Applet
                                   |
                                   +----SearchApplet

public class SearchApplet
extends Applet
implements Runnable
This applet runs a search algorithm on a tree, taking user input to determine what to search for within the tree and producing a visual representation of the search's progress through the tree. Uses some of the ideas demonstrated in the sort demo included with Sun's JDK 1.1. To use this applet, you would add a tag like the following into your HTML:
 <applet code="SearchApplet.class" width=400 height=350> 
 <PARAM name=alg value="BreadthFirstSearch"> 
 </applet>
 
If you are using the Depth-Limited algorithm, which takes a depth limit, you could also add another PARAM tag to specify that limit:
 <PARAM name=depth value="3">
 
To-do list of improvements

Author:
Naomi Novik

Variable Index

 o statusBar

Constructor Index

 o SearchApplet()

Method Index

 o addString(String)
Add the specified string to the displayed tree.
 o clearSearch()
Clear the search information while still preserving the tree.
 o clearTree()
Clear the tree completely.
 o getAppletInfo()
 o getParameterInfo()
 o handleEvent(Event)
Handle events that occur in the applet as a result of user action.
 o init()
Initialize the applet.
 o insertNode(WNode)
Insert the specified node into the tree at the next available spot (depends on branchFactor).
 o pause()
Pause a while, to make the search progress visually clearer.
 o run()
Main event loop.
 o stop()
Stop the applet.

Variables

 o statusBar
 public TextField statusBar

Constructors

 o SearchApplet
 public SearchApplet()

Methods

 o getAppletInfo
 public String getAppletInfo()
Overrides:
getAppletInfo in class Applet
 o getParameterInfo
 public String[][] getParameterInfo()
Overrides:
getParameterInfo in class Applet
 o init
 public void init()
Initialize the applet.

Overrides:
init in class Applet
 o handleEvent
 public boolean handleEvent(Event e)
Handle events that occur in the applet as a result of user action.

Overrides:
handleEvent in class Component
 o stop
 public synchronized void stop()
Stop the applet. Kill any algorithm that is still searching.

Overrides:
stop in class Applet
 o run
 public void run()
Main event loop. This will be called by the Thread forked off in startSearch. We need to set the search algorithm to be used, using the name specified in the applet's params.

 o pause
 public void pause()
Pause a while, to make the search progress visually clearer.

See Also:
SearchAlgorithm
 o clearTree
 public void clearTree()
Clear the tree completely.

 o addString
 public void addString(String s)
Add the specified string to the displayed tree.

 o insertNode
 public void insertNode(WNode n)
Insert the specified node into the tree at the next available spot (depends on branchFactor).

 o clearSearch
 public void clearSearch()
Clear the search information while still preserving the tree.