Commit 96e41055 authored by Sarah Grebing's avatar Sarah Grebing

Fixed first bug for step into proof tree, still not working properly yet

parent a027d3f9
Pipeline #16870 passed with stages
in 10 minutes and 27 seconds
...@@ -5,6 +5,11 @@ import edu.kit.iti.formal.psdbg.parser.ast.ASTNode; ...@@ -5,6 +5,11 @@ import edu.kit.iti.formal.psdbg.parser.ast.ASTNode;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.Supplier; import java.util.function.Supplier;
/**
* Continue Command if interpreter stopped at a breakpoint
*
* @param <T>
*/
public class ContinueCommand<T> extends DebuggerCommand<T> { public class ContinueCommand<T> extends DebuggerCommand<T> {
@Override @Override
public void execute(DebuggerFramework<T> dbg) { public void execute(DebuggerFramework<T> dbg) {
...@@ -24,11 +29,6 @@ public class ContinueCommand<T> extends DebuggerCommand<T> { ...@@ -24,11 +29,6 @@ public class ContinueCommand<T> extends DebuggerCommand<T> {
} }
Supplier<Integer> currenDepth = () -> dbg.getStatePointer().getContext().length; Supplier<Integer> currenDepth = () -> dbg.getStatePointer().getContext().length;
//Blocker.BlockPredicate predicate = new Blocker.ParentInContext(ctx);
// Blocker.SmallerContext predicate = new Blocker.SmallerContext(
// currenDepth.get(), currenDepth);
//dbg.releaseUntil(predicate);
dbg.release(); dbg.release();
} else { } else {
......
...@@ -5,6 +5,11 @@ import edu.kit.iti.formal.psdbg.parser.ast.ASTNode; ...@@ -5,6 +5,11 @@ import edu.kit.iti.formal.psdbg.parser.ast.ASTNode;
import java.util.Arrays; import java.util.Arrays;
import java.util.function.Supplier; import java.util.function.Supplier;
/**
* Step Over Command, to step Over a proof command
*
* @param <T>
*/
public class StepOverCommand<T> extends DebuggerCommand<T> { public class StepOverCommand<T> extends DebuggerCommand<T> {
@Override @Override
public void execute(DebuggerFramework<T> dbg) { public void execute(DebuggerFramework<T> dbg) {
......
...@@ -65,13 +65,12 @@ import java.io.PrintWriter; ...@@ -65,13 +65,12 @@ import java.io.PrintWriter;
import java.net.URL; import java.net.URL;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.time.Duration; import java.time.Duration;
import java.util.List; import java.util.*;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.*; import java.util.concurrent.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.reactfx.util.Timer;
/** /**
* Controller for the Debugger MainWindow * Controller for the Debugger MainWindow
* *
...@@ -711,7 +710,11 @@ public class DebuggerMain implements Initializable { ...@@ -711,7 +710,11 @@ public class DebuggerMain implements Initializable {
} }
/**
* Continue after the interpreter has reached a breakpoint
*
* @param event
*/
@FXML @FXML
public void continueAfterRun(ActionEvent event) { public void continueAfterRun(ActionEvent event) {
LOGGER.debug("DebuggerMain.continueAfterBreakpoint"); LOGGER.debug("DebuggerMain.continueAfterBreakpoint");
...@@ -724,6 +727,10 @@ public class DebuggerMain implements Initializable { ...@@ -724,6 +727,10 @@ public class DebuggerMain implements Initializable {
} }
} }
/**
* Reload a problem from the beginning
* @param event
*/
@FXML @FXML
public void reloadProblem(ActionEvent event) { public void reloadProblem(ActionEvent event) {
//abort current execution(); //abort current execution();
...@@ -745,9 +752,6 @@ public class DebuggerMain implements Initializable { ...@@ -745,9 +752,6 @@ public class DebuggerMain implements Initializable {
iModel.getGoals().clear(); iModel.getGoals().clear();
iModel.setSelectedGoalNodeToShow(null); iModel.setSelectedGoalNodeToShow(null);
// init();
//reload File
try { try {
FACADE.reload(lastLoaded); FACADE.reload(lastLoaded);
if (iModel.getGoals().size() > 0) { if (iModel.getGoals().size() > 0) {
...@@ -1111,24 +1115,37 @@ public class DebuggerMain implements Initializable { ...@@ -1111,24 +1115,37 @@ public class DebuggerMain implements Initializable {
Proof proof = beforeNode.getData().getProof(); Proof proof = beforeNode.getData().getProof();
Node pnode = beforeNode.getData().getNode(); Node pnode = beforeNode.getData().getNode();
System.out.println("pnode.serialNr() = " + pnode.serialNr()); // stateAfterStmt.forEach(keyDataGoalNode -> System.out.println("keyDataGoalNode.getData().getNode().serialNr() = " + keyDataGoalNode.getData().getNode().serialNr()));
stateAfterStmt.forEach(keyDataGoalNode -> System.out.println("keyDataGoalNode.getData().getNode().serialNr() = " + keyDataGoalNode.getData().getNode().serialNr()));
ptree.setProof(proof); ptree.setProof(proof);
ptree.setRoot(pnode); ptree.setRoot(pnode);
ptree.setDeactivateRefresh(true); ptree.setDeactivateRefresh(true);
//TODO Traversierung WICHTIG //TODO Traversierung WICHTIG
//this is always 0 subtreegoals dies not return the subtree
//getSubtreegoals == 0
//traverse tree to closed goals -> set Sentinels //traverse tree to closed goals -> set Sentinels
//laeves of PNode wenn aftestmt leer //laeves of PNode wenn aftestmt leer
//sonst nodes nodes afterstmt //sonst nodes nodes afterstmt
Set<Node> sentinels = proof.getSubtreeGoals(pnode)
.stream() if (stateAfterStmt.size() > 0) {
.map(Goal::node) Set<Node> sentinels = proof.getSubtreeGoals(pnode)
.collect(Collectors.toSet()); .stream()
System.out.println("Sentinels: " + sentinels.isEmpty()); .map(Goal::node)
ptree.getSentinels().addAll(sentinels); .collect(Collectors.toSet());
ptree.getSentinels().addAll(sentinels);
} else {
Set<Node> sentinels = new HashSet<>();
Iterator<Node> nodeIterator = beforeNode.getData().getNode().leavesIterator();
while (nodeIterator.hasNext()) {
Node next = nodeIterator.next();
sentinels.add(next.parent());
}
ptree.getSentinels().addAll(sentinels);
//traverseProofTreeAndAddSentinelsToLeaves();
}
ptree.expandRootToLeaves(); ptree.expandRootToLeaves();
//TODO set coloring of starting and end node //TODO set coloring of starting and end node
DockNode node = new DockNode(ptree, "Proof Tree for Step Into: " + DockNode node = new DockNode(ptree, "Proof Tree for Step Into: " +
...@@ -1138,6 +1155,7 @@ public class DebuggerMain implements Initializable { ...@@ -1138,6 +1155,7 @@ public class DebuggerMain implements Initializable {
node.dock(dockStation, DockPos.CENTER, scriptController.getOpenScripts().get(getScriptController().getMainScript().getScriptArea())); node.dock(dockStation, DockPos.CENTER, scriptController.getOpenScripts().get(getScriptController().getMainScript().getScriptArea()));
} }
} }
//endregion //endregion
} }
//deprecated //deprecated
......
...@@ -160,6 +160,13 @@ public class ProofTree extends BorderPane { ...@@ -160,6 +160,13 @@ public class ProofTree extends BorderPane {
} }
public void expandRootToLeaves() { public void expandRootToLeaves() {
if (getTreeProof().getRoot() == null) {
if (root.get() != null) {
TreeItem<TreeNode> item = new TreeItem<>(new TreeNode(root.get().serialNr() + ": " + toString(root.get()), root.get()));
treeProof.setRoot(item);
}
}
expandRootToLeaves(getTreeProof().getRoot()); expandRootToLeaves(getTreeProof().getRoot());
} }
......
// Please select one of the following scripts. // Please select one of the following scripts.
// //
script test1234(){
impRight;
auto;
}
script test23(){ script test23(){
impRight; impRight;
x:term := find(match `?rt ==>`); x:term := find(match `?rt ==>`);
......
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