Commit 2300faf2 authored by Joachim Müssig's avatar Joachim Müssig

Fix bug in SU prompt, after disproving one SU and reselect the same violation

parent 439f6b8f
......@@ -35,6 +35,7 @@ import javafx.scene.layout.AnchorPane;
import javafx.scene.paint.Color;
import javafx.util.Callback;
import joanakey.JoanaAndKeYCheckData;
import joanakey.customlistener.SummaryEdgeAndMethodToCorresData;
import joanakey.customlistener.ViolationsWrapperListener;
import joanakey.errorhandling.ErrorLogger;
import joanakey.persistence.DisprovingProject;
......@@ -388,7 +389,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
//#######################################################################
//this gets run whenever the selected SUMMARY EDGE changes-------------->
//#######################################################################
//TODO: check if the right value is selected after selecting a su with a violation
private void onSummaryEdgeSelectionChange(int newValue) {
if (newValue < 0) {
return;
......@@ -456,17 +456,21 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
showAllSU();
} else {
SDGEdge firstSU = null;
//TODO:This field is null after selecting another violation -> exception
this.currentSelectedViolation = this.itemIndexToViolation.get(newValue);
resetListView(listViewSummaryEdges);
for (SDGEdge e : currentSelectedViolation.getSummaryEdges()) {
if (e == null) break;
if (firstSU == null) {
firstSU = e;
}
if (!violationsWrapper.isCheckedEdge(e)) {
String edge = e.toString();
boolean notRemovedEdge = summaryEdgesAndCorresJavaMethods.containsKey(e);
boolean isChecked = violationsWrapper.isCheckedEdge(e);
if (notRemovedEdge && !isChecked) {
String summaryEdge = summaryEdgesAndCorresJavaMethods.get(e).toString();
listViewSummaryEdges.getItems()
.add(e.toString() + " : " + summaryEdgesAndCorresJavaMethods.get(e).toString());
//TODO: NUllpointerException ?! after all disproven ? Debug !
.add(edge + " : " + summaryEdge);
}
}
......@@ -751,6 +755,8 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
private void showAllSU() {
int i = 0;
//TODO: remove sysout
System.out.println("Number of SUMMARY EDGES : " + summaryEdgesAndCorresJavaMethods.size());
for (SDGEdge e : summaryEdgesAndCorresJavaMethods.keySet()) {
listViewSummaryEdges.getItems().add(
e.toString() +
......@@ -763,10 +769,13 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
//TODO: loaded file completely checked ?
//TODO: just append CLOSED, if not done already
//TODO: "CLOSED" check with datastructure
// just append CLOSED, if not done already
// "CLOSED" check with datastructure
// why is this method called twice ?
//TODO test cases !
private void displayAllViolationChecked() {
for (int i : itemIndexToViolation.keySet()) {
System.out.println(i);
String itemText = listViewUncheckedChops.getItems().get(i);
if (!itemText.startsWith("CLOSED: ")) {
listViewUncheckedChops.getItems().set(i, "CLOSED: " + listViewUncheckedChops.getItems().get(i));
......
......@@ -114,6 +114,8 @@ public class ViolationChop {
// nodesInChop = Utils.addChopForFields(nodesInChop, sdg, onlyStatic);
inducedSubgraph = sdg.subgraph(nodesInChop);
//clear summary edges and collect all remaining summary edges
summaryEdges.clear();
inducedSubgraph.edgeSet().forEach((e) -> {
if (isSummaryEdge(e)) {
summaryEdges.add(e);
......
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