mascoptLib.algos.abstractalgos
Class StepAlgo

java.lang.Object
  |
  +--mascoptLib.algos.abstractalgos.StepAlgo
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
Dijkstra, DijkstraAdvanced, Ressort

public abstract class StepAlgo
extends Object
implements Runnable

StepAlgo is a class wich provides a way of running an algorithm step by step. The goal is to implement an algorithm in two way: the common way where the algorithm is running as fast as possible. The other way is to debug or to perform demos. We want in this case, pause each step of the algo during some seconds. This class implements this behavior. Note that this class is derivated from Runnable wich implement the Thread system.


Constructor Summary
StepAlgo()
          Default constructor.
StepAlgo(boolean byStep)
          Default constructor.
 
Method Summary
 void byStep(boolean byStep)
          Change the algorithm behavior to run step by step.
 void ends(boolean end)
          Change the algorithm statut for end to a boolean.
 boolean isDemo()
          Say if the algorithm is in demo mode ie step by step.
 boolean isEnded()
          As the algorithm is run as a thread, we want to know when it ends.
 void nextStep()
          When calling nextStep, the algorithm is unpaused.
abstract  void run()
          Run the algorithm.
 void setTime(int time)
          Set wait time in miliseconds
 void start()
          Launch the algorithm
 void waitB()
          Give a method to put a pause in your algorithm.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StepAlgo

public StepAlgo()
Default constructor.


StepAlgo

public StepAlgo(boolean byStep)
Default constructor.

Method Detail

setTime

public void setTime(int time)
Set wait time in miliseconds

Parameters:
time - the time to wait beetween steps

start

public void start()
Launch the algorithm


nextStep

public void nextStep()
When calling nextStep, the algorithm is unpaused.


isEnded

public boolean isEnded()
As the algorithm is run as a thread, we want to know when it ends.

Returns:
a boolean saying if the algorithm ended.

ends

public void ends(boolean end)
Change the algorithm statut for end to a boolean.

Parameters:
end - the statut to store.

byStep

public void byStep(boolean byStep)
Change the algorithm behavior to run step by step.


isDemo

public boolean isDemo()
Say if the algorithm is in demo mode ie step by step.


waitB

public void waitB()
Give a method to put a pause in your algorithm.


run

public abstract void run()
Run the algorithm.

Specified by:
run in interface Runnable