# Class AlgThread

    java.lang.Object
       |
       +----java.lang.Thread
               |
               +----AlgThread

public class AlgThread
extends Thread

`AlgThread` is an extension of the provided Java multi-threading package. It enables the graphical display of the main execution thread to be updated during the execution of the algorithm.

A section of this source file is normally displayed on the TextFrame. This section starts with the line after `/*------------------*``/` and finishes before the line `//------------` . Every line starting with `/*-*``/` will be discarded in the source code display area and each line is terminated by the first encounter of `/*-*``/`.

The source file `AlgThread.java` is to be modified/completed for separate animation algorithms.

##

dataSets
  Array of strings used to set the choices of the data choice button in data menu.
drawingPanel
  A reference to the drawing panel in order to update the animation during the execution of the algorithm.
frame
  The initial caller of the constructor of this class.
max_data
  Size of the data set appropriate for algorighm animation.

##

AlgThread(AlgAnimFrame)
  Creates a new thread using the frame passed in as the parameter.

##

generateData()
  Generate data based on the choice made on the menu.
restoreDrawingPanel()
  Restore the drawing panel at the beginning or the end of each simulation.
run()
  This method is invoked when the `Thread` class `start()` method is called.
setDelay(int)
  Sets the delay between each animation step.
waitSkip()
  This method is to be placed after the line where the fast forward function is to be performed.

##

max_data

     public int max_data

  Size of the data set appropriate for algorighm animation.

dataSets

     public static String dataSets[]

  Array of strings used to set the choices of the data choice button in data menu.

frame

     public AlgAnimFrame frame

  The initial caller of the constructor of this class. It holds the references to all existing panels.

drawingPanel

     public DrawingPanel drawingPanel

  A reference to the drawing panel in order to update the animation during the execution of the algorithm.

  See Also:
    DrawingPanel

##

AlgThread

     public AlgThread(AlgAnimFrame frame)

  Creates a new thread using the frame passed in as the parameter. If this constructor is called from the frame constructor, a drawingPanel will be initialized and assigned to the frame class.

  Parameters:
    frame - An extended frame where the algorithm is going to execute in.
  See Also:
    AlgAnimFrame

##

setDelay

     public void setDelay(int delay)

  Sets the delay between each animation step. This determines the rate the drawingPanel is updated. The `setDelay` method is normally called by the action listener of the `delay choice button` on the control panel.

  Parameters:
    delay - The delay set in milliseconds.

generateData

     public void generateData()

  Generate data based on the choice made on the menu. This method is application specific and the contents for the satisfaction of each 'if' statement have to be filled in based on the algorithm.

run

     public void run()

  This method is invoked when the `Thread` class `start()` method is called. It contains the statements to execute the methods which perform the algorithm. This method is to be completed based on separate animation algorithms.

  Overrides:
    run in class Thread
  See Also:
    Thread

restoreDrawingPanel

     public void restoreDrawingPanel()

  Restore the drawing panel at the beginning or the end of each simulation.

waitSkip

     public void waitSkip()

  This method is to be placed after the line where the fast forward function is to be performed.