ciips.animation
Class AlgThread

java.lang.Object
  extended byjava.lang.Thread
      extended byciips.animation.AlgThread
All Implemented Interfaces:
java.util.EventListener, InputCompleteListener, java.awt.event.ItemListener, java.lang.Runnable

public abstract class AlgThread
extends java.lang.Thread
implements java.awt.event.ItemListener, InputCompleteListener

Animations should extend this class and implement the run and loadData methods.


Field Summary
 DrawingPanel[] d_panel
           
 AlgAnimFrame frame
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AlgThread()
           
 
Method Summary
 void generateData()
          Generate the example data set.
 java.awt.Menu getActionMenu()
          Allow the animator to create a special menu of user actions associated with this animation.
 int getDataPanelCount()
           
 java.lang.String[] getOptions()
          Return a list of options that can be set when running the algorithm: override this method in the sub-class if there are any such options.
 void inputComplete(InputDialogEvent e)
          Method which will be notified when an InputDialog completes
 void itemStateChanged(java.awt.event.ItemEvent e)
          Options are added to the Options menu: when their state changes, the algorithm thread will be notified.
abstract  boolean loadData(int choice)
          Load or generate a specified data set.
 void optionChanged(int index, boolean new_state)
          Options are added to the Options menu: when their state changes, the algorithm thread will be notified.
 void restoreDrawingPanel()
           
abstract  void run()
          Run the animation.
 void setDelay(int delay)
           
 void setParms(AlgAnimFrame frame, int frames)
           
 void setParms(AlgAnimFrame frame, java.lang.String[] ds, int frames)
           
 void setParms(AlgAnimFrame frame, java.lang.String df_prefix, int frames)
           
 void shuffleDown()
          Shuffle the previous panels down Panel with index = 0 is the current panel
 void waitSkip()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

frame

public AlgAnimFrame frame

d_panel

public DrawingPanel[] d_panel
Constructor Detail

AlgThread

public AlgThread()
Method Detail

setParms

public void setParms(AlgAnimFrame frame,
                     int frames)

setParms

public void setParms(AlgAnimFrame frame,
                     java.lang.String[] ds,
                     int frames)

setParms

public void setParms(AlgAnimFrame frame,
                     java.lang.String df_prefix,
                     int frames)

setDelay

public void setDelay(int delay)

getDataPanelCount

public int getDataPanelCount()

shuffleDown

public void shuffleDown()
Shuffle the previous panels down Panel with index = 0 is the current panel


loadData

public abstract boolean loadData(int choice)
Load or generate a specified data set. The animation writer should implement this in the specialization class. choice will be a data set index in the range 0..max_data_sets-1


generateData

public void generateData()
Generate the example data set. Reads the chosen data set from the frame's menu, and calls loadData( choice ) to load or generate the appropriate data set.


run

public abstract void run()
Run the animation. This is the key method that the animator provides: it starts up the animation and runs it to completion.

Specified by:
run in interface java.lang.Runnable

restoreDrawingPanel

public void restoreDrawingPanel()

waitSkip

public void waitSkip()

getOptions

public java.lang.String[] getOptions()
Return a list of options that can be set when running the algorithm: override this method in the sub-class if there are any such options. This method returns null.


itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Options are added to the Options menu: when their state changes, the algorithm thread will be notified. Override this method to handle changes in the options.

Specified by:
itemStateChanged in interface java.awt.event.ItemListener

optionChanged

public void optionChanged(int index,
                          boolean new_state)
Options are added to the Options menu: when their state changes, the algorithm thread will be notified. Override this method to handle changes in the options.


getActionMenu

public java.awt.Menu getActionMenu()
Allow the animator to create a special menu of user actions associated with this animation. To create a special actions menu, override this method in the algorithm thread. If this method returns a non-null menu, it will be added to the animation frame


inputComplete

public void inputComplete(InputDialogEvent e)
Description copied from interface: InputCompleteListener
Method which will be notified when an InputDialog completes

Specified by:
inputComplete in interface InputCompleteListener