Commit 27afba20 authored by Joachim Müssig's avatar Joachim Müssig

remove unused code and fix displayAllViolationsChecked

parent 2300faf2
......@@ -463,7 +463,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
if (firstSU == null) {
firstSU = e;
}
String edge = e.toString();
boolean notRemovedEdge = summaryEdgesAndCorresJavaMethods.containsKey(e);
boolean isChecked = violationsWrapper.isCheckedEdge(e);
......@@ -473,7 +472,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
.add(edge + " : " + summaryEdge);
}
}
if (firstSU != null) {
int newIndex = getSUIndex(firstSU);
if(newIndex == -1) {
......@@ -481,13 +479,16 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
this.listViewSummaryEdges.getSelectionModel().select(0);
this.onSummaryEdgeSelectionChange(newIndex);
System.out.println(currentSelectedEdge.toString());
}
}
}
/**
* Get the index of the summary edge in the corresponding listView
* @param su the summary Edge you want the index for.
* @return the index of the summary edge in the {@link listView} listViewSummaryEdge. Returns -1 if the summary edge can not be found
*/
private int getSUIndex(SDGEdge su) {
for(int i = 0; i<itemIndexToSummaryEdge.size(); i++) {
if (itemIndexToSummaryEdge.get(i) != null) {
......@@ -612,7 +613,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
listViewUncheckedChops.getItems().add("All");
//TODO dont use uncheckedViolations ! use chops ?
// Collection<? extends IViolation<SecurityNode>> uncheckedViolations =
// violationsWrapper.getUncheckedViolations();
Collection<? extends IViolation<SecurityNode>> uncheckedViolations =
......@@ -725,7 +725,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
// labelSomeOtherData.setText("All security violations have been disproved with KeY!");
this.setSomeOtherMessageAndColor("All security violations have been disproved with KeY!", Color.GREEN);
buttonRunAuto.setDisable(true);
//TODO: check this method !
displayAllViolationChecked();
// AutomationHelper.playSound(SOUND);
......@@ -755,8 +754,6 @@ 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() +
......@@ -768,13 +765,10 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
//TODO: loaded file completely checked ?
// just append CLOSED, if not done already
// "CLOSED" check with datastructure
// why is this method called twice ?
//TODO test cases !
//TODO: "CLOSED" check with datastructure
private void displayAllViolationChecked() {
for (int i : itemIndexToViolation.keySet()) {
// for (int i : itemIndexToViolation.keySet()) {
for (int i = 0; i < listViewUncheckedChops.getItems().size(); i++) {
System.out.println(i);
String itemText = listViewUncheckedChops.getItems().get(i);
if (!itemText.startsWith("CLOSED: ")) {
......@@ -783,12 +777,10 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
}
//TODO: correct this and use this method to close violations if possible after disproving a SU
private void checkCloseViolation(ViolationChop v) {
for(int i : itemIndexToViolation.keySet()) {
if (i != 0) {
if (itemIndexToViolation.get(i).equals(v)) {
//FIXME: index out of bound exception if all disproven !
if (!violationsWrapper.getAllViolationChops().contains(v)) {
String itemText = listViewUncheckedChops.getItems().get(i);
if (!itemText.startsWith("CLOSED: ")) {
......@@ -798,60 +790,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
}
}
// if (false) {
// itemIndexToViolation.forEach((index, itemViolation) -> {
// if (index != 0) {
// int i = index;
// String item = listViewUncheckedChops.getItems().get(index);
// Collection<ViolationChop> s = violationsWrapper.getAllViolationChops();
// System.out.println(s);
// if (!violationsWrapper.getAllViolationChops().contains(itemViolation)) {
// System.out.println("close: " +i);
// if (!item.startsWith("CLOSED")) {
// listViewUncheckedChops.getItems().set(index, "CLOSED: " + item);
// }
// if (violationsWrapper.allCheckedOrDisproved()) {
// // All closed
// item = listViewUncheckedChops.getItems().get(0);
// listViewUncheckedChops.getItems().set(0, "CLOSED: " + item);
// }
// }
//
// }
//
// });
// }
// boolean closeViolation = true;
// Collection<SDGEdge> suEdges = itemViolation.getSummaryEdges();
// for (SDGEdge edge : suEdges) {
// if (!violationsWrapper.isCheckedEdge(edge)) {
// closeViolation = false;
// }
// }
// if (closeViolation) {
// listViewUncheckedChops.getItems().set(index, listViewUncheckedChops.getItems().get(index) + " CLOSED");
//
// //TODO: dont remove it -> disable list element and mark it as closed.
// listViewUncheckedChops.getItems().remove(index);
// listViewUncheckedChops.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
// @Override
// public ListCell<String> call(ListView<String> param) {
// return new ListCell<String>() {
// @Override
// protected void updateItem(String item, boolean empty) {
// super.updateItem(item, empty);
// if(item.contains(" CLOSED")) {
// setDisable(true);
// }
// setText(item);
// }
//
// };
// }
// });
// }
}
private void clearView() {
......
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