Commit d0906b07 authored by Sarah Grebing's avatar Sarah Grebing

cleaning

parent 68463826
......@@ -4,8 +4,12 @@ import de.uka.ilkd.key.proof.init.ProofInputException;
import de.uka.ilkd.key.speclang.Contract;
import edu.kit.formal.gui.controls.*;
import edu.kit.formal.gui.model.RootModel;
import edu.kit.formal.interpreter.*;
import edu.kit.formal.interpreter.Interpreter;
import edu.kit.formal.interpreter.InterpreterBuilder;
import edu.kit.formal.interpreter.KeYProofFacade;
import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.graphs.PTreeNode;
import edu.kit.formal.interpreter.graphs.ProofTreeController;
import edu.kit.formal.proofscriptparser.Facade;
import edu.kit.formal.proofscriptparser.ast.ProofScript;
import javafx.beans.property.SimpleBooleanProperty;
......
......@@ -14,7 +14,7 @@ import javafx.concurrent.Task;
*
* @author A. Weigl
*/
class InterpretingService extends Service<State<KeyData>> {
public class InterpretingService extends Service<State<KeyData>> {
/**
* The interpreter (with teh appropriate KeY state) that is used to traverse and execute the script
......@@ -31,7 +31,7 @@ class InterpretingService extends Service<State<KeyData>> {
*/
private PuppetMaster blocker;
InterpretingService(PuppetMaster blocker) {
public InterpretingService(PuppetMaster blocker) {
this.blocker = blocker;
}
......
package edu.kit.formal.interpreter;
import edu.kit.formal.interpreter.graphs.PTreeNode;
import lombok.Getter;
/**
......
package edu.kit.formal.interpreter.exceptions;
/**
* Exception that is thrown if State graph could not be build properly
*/
public class StateGraphException extends RuntimeException {
public StateGraphException() {
super();
}
public StateGraphException(String message) {
super(message);
}
public StateGraphException(String message, Throwable cause) {
super(message, cause);
}
public StateGraphException(Throwable cause) {
super(cause);
}
protected StateGraphException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
import edu.kit.formal.proofscriptparser.ast.ASTNode;
......@@ -6,7 +6,7 @@ import java.util.LinkedList;
import java.util.List;
/**
* ControlFlowNode for ControlFlowGraph to look up step-edges for teh debugger.
* ControlFlowNode for ControlFlowGraph to look up step-edges for the debugger.
*/
public class ControlFlowNode {
......@@ -47,7 +47,7 @@ public class ControlFlowNode {
StringBuilder sb = new StringBuilder();
sb.append("Node {");
if (scriptstmt != null) {
sb.append(scriptstmt.getNodeName().toString() + "@" + scriptstmt.getStartPosition());
sb.append(scriptstmt.getNodeName()).append("@").append(scriptstmt.getStartPosition());
} else {
sb.append("No Stmt");
}
......
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
/**
* Created by sarah on 6/20/17.
* Edge Types a state graph and control flow graph may have
*/
public enum EdgeTypes {
STEP_INTO, STEP_OVER, STEP_BACK, STEP_RETURN, STEP_OVER_COND, STATE_FLOW;
......
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
import edu.kit.formal.interpreter.NodeAddedEvent;
/**
* Listener for Change events in the state graph
......
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.data.State;
......@@ -7,7 +7,7 @@ import edu.kit.formal.proofscriptparser.ast.ASTNode;
import java.util.LinkedList;
/**
* Inner class representing nodes in the graph
* Inner class representing nodes in the stategraph graph
* A node contains a reference to the ASTNode and a reference to the corresponding interpreter state if this state is already interpreted, null otherwise.
*/
public class PTreeNode {
......
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
import com.google.common.graph.EndpointPair;
import com.google.common.graph.MutableValueGraph;
......
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
import edu.kit.formal.gui.controller.PuppetMaster;
import edu.kit.formal.interpreter.Interpreter;
import edu.kit.formal.interpreter.InterpretingService;
import edu.kit.formal.interpreter.data.GoalNode;
import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.data.State;
......@@ -162,8 +164,7 @@ public class ProofTreeController {
*/
public PTreeNode stepBack() {
PTreeNode current = statePointer;
PTreeNode backState = stateGraphVisitor.getStepBack(current);
this.statePointer = backState;
this.statePointer = stateGraphVisitor.getStepBack(current);
setNewState(statePointer.getState());
return statePointer;
......
package edu.kit.formal.interpreter;
package edu.kit.formal.interpreter.graphs;
import com.google.common.graph.MutableValueGraph;
import com.google.common.graph.ValueGraphBuilder;
import edu.kit.formal.interpreter.Interpreter;
import edu.kit.formal.interpreter.NodeAddedEvent;
import edu.kit.formal.interpreter.data.KeyData;
import edu.kit.formal.interpreter.data.State;
import edu.kit.formal.interpreter.exceptions.StateGraphException;
import edu.kit.formal.proofscriptparser.DefaultASTVisitor;
import edu.kit.formal.proofscriptparser.ast.*;
import javafx.application.Platform;
......@@ -19,7 +22,7 @@ import java.util.Set;
/**
* State graph that is computed on the fly while stepping through script
* A Node in the graph is a PTreeNode {@link edu.kit.formal.interpreter.PTreeNode}
* A Node in the graph is a PTreeNode {@link PTreeNode}
* Edges are computed on the fly while
*/
public class StateGraphVisitor extends DefaultASTVisitor<Void> {
......@@ -85,10 +88,13 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {
public void createRootNode(ASTNode node) {
PTreeNode newStateNode = new PTreeNode(node);
newStateNode.setState(currentInterpreter.getCurrentState().copy());
stateGraph.addNode(newStateNode);
this.root.set(newStateNode);
lastNode = newStateNode;
boolean res = stateGraph.addNode(newStateNode);
if (!res) {
throw new StateGraphException("Could not create new state for ASTNode " + node + " and add it to the stategraph");
} else {
this.root.set(newStateNode);
lastNode = newStateNode;
}
}
public void setUpGraph() {
......@@ -161,8 +167,7 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {
*/
public Void createNewNode(ASTNode node) {
State<KeyData> lastState = lastNode.getState();
//maybe delete
//lastNode.setState(currentInterpreter.getCurrentState());
PTreeNode newStateNode;
newStateNode = new PTreeNode(node);
......@@ -273,7 +278,7 @@ public class StateGraphVisitor extends DefaultASTVisitor<Void> {
}
protected void fireNodeAdded(NodeAddedEvent nodeAddedEvent) {
private void fireNodeAdded(NodeAddedEvent nodeAddedEvent) {
changeListeners.forEach(list -> {
Platform.runLater(() -> {
list.graphChanged(nodeAddedEvent);
......
package edu.kit.formal.interpreter;
import edu.kit.formal.interpreter.funchdl.DefaultLookup;
import edu.kit.formal.interpreter.graphs.ProgramFlowVisitor;
import edu.kit.formal.proofscriptparser.Facade;
import edu.kit.formal.proofscriptparser.ScriptLanguageParser;
import edu.kit.formal.proofscriptparser.TransformAst;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment