|
@@ -7,6 +7,7 @@ import bk.BlockCalc;
|
|
|
/**
|
|
|
* Represents a specific stage of the algorithm.
|
|
|
* Example calculating the blocks, see {@link BlockCalc}.
|
|
|
+ * Each of those stages also has an associated {@link PseudoCodeNode}, i.e., a line of pseudocode.
|
|
|
*
|
|
|
* @author kolja
|
|
|
*
|
|
@@ -25,28 +26,63 @@ public interface AlgorithmStage {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * perform one atomic step of the algorithm
|
|
|
- * @return whether the whole stage is finished.
|
|
|
- * For example if all steps are reverted, then {@code FINISHED} is returned.
|
|
|
+ * Perform one atomic step of the algorithm. Stops at the end of the program.
|
|
|
+ * @return whether the whole stage is finished (afterwards).
|
|
|
+ * For example if all steps are finished, then {@code FINISHED} is returned.
|
|
|
*/
|
|
|
public StageStatus forwardStep();
|
|
|
|
|
|
+ /**
|
|
|
+ * Perform steps until the next line of code on the same level of indentation as this line
|
|
|
+ * is reached. Stops at the end of the program.
|
|
|
+ * @return whether the whole stage is finished (afterwards).
|
|
|
+ * For example if all steps are finished, then {@code FINISHED} is returned.
|
|
|
+ */
|
|
|
public StageStatus forwardStepOver();
|
|
|
|
|
|
+ /**
|
|
|
+ * Perform steps until the next line of code on the level of indentation above this lines
|
|
|
+ * level is reached. Stops at the end of the program.
|
|
|
+ * @return whether the whole stage is finished (afterwards).
|
|
|
+ * For example if all steps are finished, then {@code FINISHED} is returned.
|
|
|
+ */
|
|
|
public StageStatus forwardStepOut();
|
|
|
|
|
|
/**
|
|
|
- * undo one atomic step of the algorithm
|
|
|
- * @return whether the whole stage is finished in backwards direction.
|
|
|
- * For example if all steps are reverted, then {@code FINISHED} is returned.
|
|
|
+ * Undo one atomic step of the algorithm. Stops at the beginning of the program.
|
|
|
+ * @return whether the whole stage is finished in backwards direction (afterwards).
|
|
|
+ * For example if all steps have been reverted, then {@code FINISHED} is returned.
|
|
|
*/
|
|
|
public StageStatus backwardStep();
|
|
|
|
|
|
+ /**
|
|
|
+ * Perform backward steps until the previous line of code on the same level of indentation
|
|
|
+ * as this line is reached. Stops at the end of the program.
|
|
|
+ * @return whether the whole stage is finished in backwards direction (afterwards).
|
|
|
+ * For example if all steps have been reverted, then {@code FINISHED} is returned.
|
|
|
+ */
|
|
|
public StageStatus backwardStepOver();
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Perform backward steps until the previous line of code on the level of indentation above
|
|
|
+ * this lines level is reached. Stops at the end of the program.
|
|
|
+ * @return whether the whole stage is finished in backwards direction (afterwards).
|
|
|
+ * For example if all steps have been reverted, then {@code FINISHED} is returned.
|
|
|
+ */
|
|
|
public StageStatus backwardStepOut();
|
|
|
|
|
|
+ /**
|
|
|
+ * Creates a {@link PseudoCodeNode}, i.e., a line of pseudocode that resembles this Stage.
|
|
|
+ * @param tree The {@link JTree} where the node should be inserted.
|
|
|
+ * @return The node.
|
|
|
+ */
|
|
|
public PseudoCodeNode createPseudocodeTree( JTree tree );
|
|
|
|
|
|
+ /**
|
|
|
+ * Writes the state of the variables used in this stage to a pretty table.
|
|
|
+ * This table should also render nicely if interpreted as markdown.
|
|
|
+ * @return the table
|
|
|
+ */
|
|
|
public String getDebugString();
|
|
|
}
|