Commit 6019bbae authored by Sarah Grebing's avatar Sarah Grebing

interim

parent 0e8cb6d1
package edu.kit.iti.formal.psdbg.interpreter.data;
import edu.kit.iti.formal.psdbg.parser.ast.CaseStatement;
import java.util.*;
import java.util.stream.Collectors;
public class InterpreterExtendedState<T> extends State<T> {
private Map<CaseStatement, List<GoalNode<T>>> mappingOfCaseToStates = new HashMap<>();
public InterpreterExtendedState(Collection<GoalNode<T>> goals, GoalNode selected) {
super(goals, selected);
}
public InterpreterExtendedState(Collection<GoalNode<T>> goals, GoalNode selected, Map<CaseStatement, List<GoalNode<T>>> casesMapping) {
super(goals, selected);
this.mappingOfCaseToStates = casesMapping;
}
public Map<CaseStatement, List<GoalNode<T>>> getMappingOfCaseToStates() {
return mappingOfCaseToStates;
}
public void setMappingOfCaseToStates(Map<CaseStatement, List<GoalNode<T>>> mappingOfCaseToStates) {
this.mappingOfCaseToStates = mappingOfCaseToStates;
}
public List<GoalNode<T>> getClosedNodes() {
return super.getGoals().stream().filter(nodes -> nodes.isClosed()).collect(Collectors.toList());
}
public List<GoalNode<T>> getopenNodes() {
return super.getGoals().stream().filter(nodes -> !nodes.isClosed()).collect(Collectors.toList());
}
public List<GoalNode<T>> getActiveGoalsForCase(CaseStatement caseStmt) {
return mappingOfCaseToStates.getOrDefault(caseStmt, Collections.emptyList());
}
//getuserSelected/
//verfuegbar im case
//map<case, listgoal>
//regel anwendbar oder nicht
}
package edu.kit.iti.formal.psdbg.interpreter.graphs;
import edu.kit.iti.formal.psdbg.interpreter.data.InterpreterExtendedState;
import edu.kit.iti.formal.psdbg.interpreter.data.State;
import edu.kit.iti.formal.psdbg.parser.ast.ASTNode;
import edu.kit.iti.formal.psdbg.parser.ast.CaseStatement;
import java.util.LinkedList;
......@@ -15,6 +17,8 @@ public class PTreeNode<T> {
*/
private State<T> state;
private InterpreterExtendedState<T> extendedState;
/**
* Statement
*/
......@@ -58,6 +62,17 @@ public class PTreeNode<T> {
this.context = context;
}
public InterpreterExtendedState<T> getExtendedState() {
return extendedState;
}
public void setExtendedState(State<T> state) {
this.extendedState = new InterpreterExtendedState<>(state.getGoals(), state.getSelectedGoalNode());
if (getScriptstmt() instanceof CaseStatement) {
}
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("Node {");
......
......@@ -200,8 +200,8 @@ public class StateGraphWrapper<T> {
public Void addState(ASTNode node) {
PTreeNode newStateNode = addedNodes.get(node);
State<T> currentState = currentInterpreter.getCurrentState().copy();
newStateNode.setState(currentState);
newStateNode.setExtendedState(currentState);
return null;
}
......
......@@ -17,10 +17,15 @@ import javafx.scene.paint.Color;
* @author Alexander Weigl
*/
public class InspectionModel {
private final ObjectProperty<ASTNode> node = new SimpleObjectProperty<>(this, "node");
//alle aktuellen nicht geschlossene Ziele -> alle leaves später (open+closed)
private final ListProperty<GoalNode<KeyData>> goals = new SimpleListProperty<>(this, "goals");
//sicht user selected
private final ObjectProperty<GoalNode<KeyData>> selectedGoalNodeToShow = new SimpleObjectProperty<>(this, "selectedGoalNodeToShow");
//aktuell im Interpreter aktives Goal
private final ObjectProperty<GoalNode<KeyData>> currentInterpreterGoal = new SimpleObjectProperty<>(this, "currentInterpreterGoal");
private final MapProperty<GoalNode, Color> colorofEachGoalNodeinListView = new SimpleMapProperty<>(FXCollections.observableHashMap());
//private final StringProperty javaString = new SimpleStringProperty();
private final SetProperty<Integer> highlightedJavaLines = new SimpleSetProperty<>(FXCollections.observableSet(), "highlightedJavaLines");
......
// Please select one of the following scripts.
//
script test2(){
impRight;
impLeft;
cases{
case match `q==> `:
impRight;
default:
impRight;
notRight;
}
script test(){
}
......
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