123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package Algorithms.Animated;
- import Model.LayeredGraphNode;
- public abstract class AnnimatedAlgorithm extends Thread implements AlgorithmStep {
- protected AnnimationController ac;
- protected LayeredGraphNode graph;
-
- public AnnimatedAlgorithm( AnnimationController controller, LayeredGraphNode graph )
- {
- this.ac = controller;
- this.graph = graph;
- if( controller != null )
- start();
- }
-
- @Override
- public void run()
- {
- while( true )
- {
- try {
- switch( ac.getNextAction() )
- {
- case FORWARD:
- System.out.println( "FORWARD" );
- forwardStep();
- break;
- case BACKWARD:
- System.out.println( "BACKWARD" );
- backwardStep();
- break;
- }
- } catch (InterruptedException e) {
- e.printStackTrace();
- return;
- }
-
- }
- }
- }
|