de.upb.swt.epctools.simulator
Class EPCComputationThread

java.lang.Object
  extended by de.upb.swt.epctools.simulator.EPCComputationThread
Direct Known Subclasses:
EPCSimulator.RefreshHighlightingComputationThread, EPCSimulator.RefreshInformationComputationThread

public abstract class EPCComputationThread
extends java.lang.Object


Nested Class Summary
 class EPCComputationThread.CancelDialog
          This class implements a SWT Dialog with a cancel button.
 class EPCComputationThread.NonExclusiveComputationThread
          This class implements the thread mechanism but without a check whether an old thread is still running.
 
Field Summary
private  boolean m_aborted
           
private static EPCComputationThread m_current_computation_thread
           
private  java.lang.String m_dialog_title
           
private  EPCComputationThread.NonExclusiveComputationThread m_ne_computation_thread
           
private static int m_running_computation_threads
           
private  boolean m_use_thread_mechanism
           
 
Constructor Summary
EPCComputationThread(java.lang.String dialog_title)
          Constructor
 
Method Summary
 void abortComputation()
          This function is called when the cancel button has been pushed It should be implemented by the sub-class.
static EPCComputationThread getCurrentComputationThread()
          Returns the current computation thread.
 EPCComputationThread.CancelDialog getDialog()
           
 boolean isAborted()
           
static boolean isThreadRunning()
           
 boolean isUsed()
          Returns true if the thread mechanism is used.
abstract  void performComputation()
          This is the method that will run in a separated thread.
 void setDialogTitle(java.lang.String dialog_title)
           
abstract  void startComputation()
          This function should be implemented by the sub-class and should start a compuation using the overloaded startComputation(...) function.
protected  void startComputation(boolean in_a_thread)
          This function starts the computation in a new thread verifying that no other instance is already running.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_current_computation_thread

private static EPCComputationThread m_current_computation_thread

m_running_computation_threads

private static int m_running_computation_threads

m_ne_computation_thread

private EPCComputationThread.NonExclusiveComputationThread m_ne_computation_thread

m_dialog_title

private java.lang.String m_dialog_title

m_use_thread_mechanism

private boolean m_use_thread_mechanism

m_aborted

private boolean m_aborted
Constructor Detail

EPCComputationThread

public EPCComputationThread(java.lang.String dialog_title)
Constructor

Method Detail

getCurrentComputationThread

public static EPCComputationThread getCurrentComputationThread()
Returns the current computation thread. Note that there can never be two computation threads running at the same time.


performComputation

public abstract void performComputation()
                                 throws EPCComputationException
This is the method that will run in a separated thread. This function is called in the dependent inner class NonExclusiveComputationThread.

Throws:
EPCComputationException

startComputation

public abstract void startComputation()
                               throws EPCComputationException
This function should be implemented by the sub-class and should start a compuation using the overloaded startComputation(...) function.

Throws:
EPCComputationException

abortComputation

public void abortComputation()
This function is called when the cancel button has been pushed It should be implemented by the sub-class.


startComputation

protected void startComputation(boolean in_a_thread)
                         throws EPCComputationException
This function starts the computation in a new thread verifying that no other instance is already running.

Throws:
EPCComputationException

getDialog

public final EPCComputationThread.CancelDialog getDialog()

setDialogTitle

public final void setDialogTitle(java.lang.String dialog_title)

isUsed

public final boolean isUsed()
Returns true if the thread mechanism is used.


isThreadRunning

public static boolean isThreadRunning()

isAborted

public boolean isAborted()