AlgorithmStage.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package animation;
  2. import javax.swing.JTree;
  3. import bk.BlockCalc;
  4. /**
  5. * Represents a specific stage of the algorithm.
  6. * Example calculating the blocks, see {@link BlockCalc}.
  7. *
  8. * @author kolja
  9. *
  10. */
  11. public interface AlgorithmStage {
  12. /**
  13. * Indicates whether the whole stage is finished.
  14. * @author kolja
  15. *
  16. */
  17. public static enum StageStatus
  18. {
  19. UNFINISHED,
  20. FINISHED
  21. }
  22. /**
  23. * perform one atomic step of the algorithm
  24. * @return whether the whole stage is finished.
  25. * For example if all steps are reverted, then {@code FINISHED} is returned.
  26. */
  27. public StageStatus forwardStep();
  28. public StageStatus forwardStepOver();
  29. public StageStatus forwardStepOut();
  30. /**
  31. * undo one atomic step of the algorithm
  32. * @return whether the whole stage is finished in backwards direction.
  33. * For example if all steps are reverted, then {@code FINISHED} is returned.
  34. */
  35. public StageStatus backwardStep();
  36. public StageStatus backwardStepOver();
  37. public StageStatus backwardStepOut();
  38. public PseudoCodeNode createPseudocodeTree( JTree tree );
  39. }