/**
 * 
 */
package edu.kit.iti.formal.pse.worthwhile.interpreter;

import edu.kit.iti.formal.pse.worthwhile.model.ast.Assertion;
import edu.kit.iti.formal.pse.worthwhile.model.ast.Expression;
import edu.kit.iti.formal.pse.worthwhile.model.ast.Statement;

/** 
 *
 */
public abstract class AbstractDebugEventListener {
	/** 
	 * @param statement
	 */
	
	public void statementExecuted(Statement statement) {
		// begin-user-code
		// TODO Auto-generated method stub
		// end-user-code
	}

	/** 
	 * @param statement
	 */
	public void statementWillExecute(Statement statement) {
		// begin-user-code
		// TODO Auto-generated method stub
		// end-user-code
	}

	/** 
	 * @param statement
	 * @param error
	 */
	public void executionFailed(Statement statement, InterpreterError error) {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}

	/** 
	 * @param statement
	 * @param breakpoint
	 */
	public void breakpointReached(Statement statement, LineBreakpoint breakpoint) {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}

	/** 
	 * 
	 */
	public void executionStarted() {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}

	/** 
	 * 
	 */
	public void executionCompleted() {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}

	/** 
	 * @param assertion
	 */
	public void assertionFailed(Assertion assertion) {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}

	/** 
	 * @param assertion
	 */
	public void assertionSucceeded(Assertion assertion) {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}

	/** 
	 * @param expression
	 */
	public void expressionEvaluated(Expression expression) {
		// begin-user-code
		// TODO Auto-generated method stub

		// end-user-code
	}
}
/**
 * Default listener for interpreter events.
 */
package edu.kit.iti.formal.pse.worthwhile.interpreter;

import edu.kit.iti.formal.pse.worthwhile.model.ast.Assertion;
import edu.kit.iti.formal.pse.worthwhile.model.ast.Expression;
import edu.kit.iti.formal.pse.worthwhile.model.ast.Statement;

public abstract class AbstractDebugEventListener {
	/** 
	 * Called every time a Statement has been executed by the Interpreter
	 * @param statement the Statement that was executed
	 */
	
	public void statementExecuted(Statement statement) {
		return;
	}

	/** 
	 * Called every time a Statement will be executed
	 * @param statement the Statement that will be executed
	 */
	public void statementWillExecute(Statement statement) {
		return;
	}

	/** 
	 * Called after the execution of a Statement failed
	 * @param statement the Statement that failed to execute
	 * @param error an InterpreterError object that describes the error
	 */
	public void executionFailed(Statement statement, InterpreterError error) {
		throw new RuntimeException("Failed to execute " + statement.toString()
				+ "; Got error " + error.toString());
	}

	/** 
	 * Called after a breakpoint has interrupted execution
	 * @param statement the statement that would be executed next
	 * @param breakpoint the breakpoint that was hit
	 */
	public void breakpointReached(Statement statement, LineBreakpoint breakpoint) {
		// Just ignore the breakpoint
		return;
	}

	/** 
	 * Called after the start of the execution of a <code>Program</code>
	 */
	public void executionStarted() {
		return;
	}

	/** 
	 * Called after the successful completion of execution of a <code>Program</code>
	 */
	public void executionCompleted() {
		return;
	}

	/** 
	 * Called after the execution of an assertion that was not valid
	 * @param assertion the invalid assertion
	 */
	public void assertionFailed(Assertion assertion) {
		throw new RuntimeException(assertion.toString() + " is invalid.");
	}

	/** 
	 * Called after the execution of an assertion that was valid
	 * @param assertion the valid assertion
	 */
	public void assertionSucceeded(Assertion assertion) {
		return;
	}

	/** 
	 * Called after the evaluation of a <code>Expression</code>
	 * @param expression the expression that was evaluated
	 */
	public void expressionEvaluated(Expression expression) {
		return;
	}
}
Document and implement DebugEventListener