12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package processor;
- import codeline.CodeLine.BackwardAction;
- /**
- * specifies what should be done after executing a line of code.
- * @author kolja
- *
- */
- public class ControlFlow {
- public static final int STEP_INTO = 0;
- public static final int STEP_OVER = 1;
- public static final int CALL = 2;
-
- private int status;
- private PseudoCodeNode function;
- private PseudoCodeNode jumpBack;
- private BackwardAction reverse;
-
- /**
- * creates a new {@link ControlFlow} from a given status
- * @param status one of ControlFlow.STEP_INTO, ControlFlow.STEP_OVER or ControlFlow.CALL
- */
- public ControlFlow( int status )
- {
- this.status = status;
- function = null;
- jumpBack = null;
- reverse = null;
- }
-
- /**
- * creates a new {@link ControlFlow} that is a function call
- * @param functionNode the {@link PseudoCodeNode} of the function to call
- */
- public ControlFlow( PseudoCodeNode functionNode )
- {
- status = CALL;
- function = functionNode;
- jumpBack = null;
- reverse = null;
- }
-
- /*
- * Package Private from here on
- * This is wanted because the individual algorithms should not have access to these functions
- */
-
- void setJumpBack( PseudoCodeNode jB )
- {
- jumpBack = jB;
- }
-
- void setBackwardAction( BackwardAction bka )
- {
- reverse = bka;
- }
-
- void backward( Memory m )
- {
- if( reverse != null )
- reverse.backward( m );
- }
-
- PseudoCodeNode getJumpBack()
- {
- return jumpBack;
- }
-
- PseudoCodeNode getFunction()
- {
- return function;
- }
-
- int getStatus()
- {
- return status;
- }
- }
|