byucc.jhdl.apps.util
Class SimulatorThread

java.lang.Object
  extended bybyucc.jhdl.apps.util.SwingWorker
      extended bybyucc.jhdl.apps.util.SimulatorThread
Direct Known Subclasses:
ClockThread, StimulatorThread

public abstract class SimulatorThread
extends SwingWorker

This abstract class is subclassed by StimulatorThread and ClockThread. This class manages the queue of SimulatorThreads to ensure that they are executed in the order they were created. NOTE that it is the order of creation, not necessarily the order of invoking the start() method that matters. Therefore, to set the order of SimulatorThread execution, make sure you carefully control the order of SimulatorThread creation.

Subclasses of this class must still implement the public Object construct() method. This method should implement the actual processing core of the the thread.

Author:
Anthony L. Slade
See Also:
StimulatorThread, ClockThread

Constructor Summary
SimulatorThread()
          This constructor will enqueue this thread in the SimulatorThread queue.
 
Method Summary
 void addReturnedListener(SimulatorThreadListener listener)
          Registers a SimulatorThreadListener with this thread.
 void finished()
          This just makes sure that the next thread is started if the queue is still not empty.
 void start()
          Overrides the start method of the SwingWorker class to make sure that this thread is really only started if it is at the head of the SimulatorThread queue.
 
Methods inherited from class byucc.jhdl.apps.util.SwingWorker
construct, get, getValue, interrupt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimulatorThread

public SimulatorThread()
This constructor will enqueue this thread in the SimulatorThread queue.

Method Detail

addReturnedListener

public void addReturnedListener(SimulatorThreadListener listener)
Registers a SimulatorThreadListener with this thread. The listener will have it simulatorThreadReturned method called when this thread finishes execution

Parameters:
listener - the new listener to register

start

public void start()
Overrides the start method of the SwingWorker class to make sure that this thread is really only started if it is at the head of the SimulatorThread queue.

Overrides:
start in class SwingWorker

finished

public void finished()
This just makes sure that the next thread is started if the queue is still not empty. For now, subclasses should not override this method, or they should at least call this method within their finished method.

Overrides:
finished in class SwingWorker


Copyright ? 2006 Brigham Young University, Configurable Computing Laboratory. All Rights Reserved.