Commit fb230341 authored by Joachim Müssig's avatar Joachim Müssig

code clear up, javadoc

parent 434d47af
......@@ -6,7 +6,6 @@
package gui;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
......@@ -15,7 +14,6 @@ import java.util.Map;
import java.util.Set;
import org.fxmisc.richtext.CodeArea;
import org.jgrapht.ext.JGraphModelAdapter.CellFactory;
import edu.kit.joana.ifc.sdg.core.SecurityNode;
import edu.kit.joana.ifc.sdg.core.violations.ClassifiedViolation;
......@@ -37,7 +35,6 @@ 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;
......@@ -49,7 +46,7 @@ import keyjoana.settings.SettingsObserver;
/**
*
* @author holger
* @author holger, joachim
*/
public class DisproHandler implements ViolationsWrapperListener, SettingsObserver {
......@@ -91,7 +88,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
private AnchorPane anchorPaneKeyContract;
private Map<Integer, ViolationChop> itemIndexToViolation = new HashMap<>();
private Map<ViolationChop, Boolean> violationChecked = new HashMap<>();
private Map<Integer, SDGEdge> itemIndexToSummaryEdge = new HashMap<>();
private HashMap<Integer, SDGNodeTuple> currentIndexToNodeTuple = new HashMap<>();
private Map<SDGEdge, StaticCGJavaMethod> summaryEdgesAndCorresJavaMethods;
......@@ -103,7 +99,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
private SDGEdge currentSelectedEdge;
private StaticCGJavaMethod currentSelectedMethod;
private CurrentActionLogger currentActionLogger;
private boolean autoRunIsRunning = false;
private boolean useSlicing = false;
private boolean useLoopUnwinding = false;
private boolean useMethodInlining = false;
......@@ -204,6 +199,11 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
setSUViewListFactory();
}
/**
* enable or disable all Buttons
* (auto run, mark as disproven, reset loop invariant, save loop invariant, open selected in KeY and try Disprove)
* @param disable true to disable all {@link Button}s or false to enable all {@link Button}s.
*/
public void setAllButtonsDisable(boolean disable) {
buttonRunAuto.setDisable(disable);
buttonMarkAsDisproved.setDisable(disable);
......@@ -213,6 +213,9 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
buttonTryDisprove.setDisable(disable);
}
/**
* toggle availability of all Buttons except the Auto run button.
*/
private void toggleButtonsForAutoRun() {
buttonMarkAsDisproved.setDisable(!buttonMarkAsDisproved.isDisabled());
buttonResetLoopInvariant.setDisable(!buttonResetLoopInvariant.isDisabled());
......@@ -342,6 +345,12 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
return disprovingProject;
}
/**
* generate a new {@link DisprovingProject} with the given {@link JoanaAndKeYCheckData}. This method disable all Buttons while generating
* the {@link DisprovingProject}.
* @param checkData
*/
public void handleNewDispro(JoanaAndKeYCheckData checkData) {
setAllButtonsDisable(true);
backgroundDisproCreator.generateFromCheckData(checkData, (dispro, worked) -> {
......@@ -769,7 +778,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);
});
......@@ -822,7 +830,7 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
//TODO: "CLOSED" check with datastructure
//TODO: "CLOSED" check with datastructure. Dont use the the list item name ?
private void displayAllViolationChecked() {
// for (int i : itemIndexToViolation.keySet()) {
for (int i = 0; i < listViewUncheckedChops.getItems().size(); i++) {
......@@ -884,8 +892,6 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
if (item.startsWith("CLOSED")) {
setStyle("-fx-control-inner-background: " + HIGHLIGHTED_CONTROL_INNER_BACKGROUND + ";");
//TODO: dont disable, so you can still see the disproven edges. But disable the buttons for closed summary edges !
// setDisable(true);
if(!violationsWrapper.allCheckedOrDisproved()) {
listViewUncheckedChops.getSelectionModel().select(0);
......@@ -903,8 +909,8 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
/**
* this method set the cell factory of the violation listView.
* Change the cells if the violation is closed/checked
* this method set the cell factory of the summary edges listView.
* Change the cells occurrence if the summary edge is closed/checked
*/
private void setSUViewListFactory() {
listViewSummaryEdges.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {
......@@ -936,6 +942,11 @@ public class DisproHandler implements ViolationsWrapperListener, SettingsObserve
}
/**
* set the gui status 'other message' to the given message in the given color
* @param message you want to print at the gui
* @param color in which you would like to have the message
*/
public void setSomeOtherMessageAndColor(String message, javafx.scene.paint.Color color) {
this.labelSomeOtherData.setText(message);
this.labelSomeOtherData.setTextFill(color);
......
......@@ -8,6 +8,7 @@ package gui;
import java.io.IOException;
import java.util.ArrayList;
import edu.kit.joana.ifc.sdg.graph.SDG;
import edu.kit.joana.ifc.sdg.graph.SDGEdge;
import edu.kit.joana.ifc.sdg.graph.SDGNodeTuple;
import joanakey.AutomationHelper;
......@@ -19,11 +20,10 @@ import joanakey.violations.ViolationChop;
import joanakey.violations.ViolationsDisproverSemantic;
import joanakey.violations.ViolationsDisproverSemantic.PO_TYPE;
import joanakey.violations.ViolationsWrapper;
import keyjoana.settings.SettingsObserver;
/**
*
* @author holger
* this class can be used to start the disproving process with KeY (also with command line mode)
* @author holger, joachim
*/
public class JoanaKeYInterfacer {
......@@ -83,6 +83,14 @@ public class JoanaKeYInterfacer {
}
}
/**
* try to disprove the given summary Edge with KeY in command line mode.
* @param e {@link SDGEdge} you want to disprove
* @param tuple
* @param corresMethod
* @return true if successfully disproven. Otherwise return False.
* @throws IOException
*/
public boolean tryDisproveEdge(
SDGEdge e,
SDGNodeTuple tuple,
......@@ -111,6 +119,11 @@ public class JoanaKeYInterfacer {
return worked;
}
/**
* mark the given {@link SDGEdge} as disproven and remove it from the {@link SDG} in {@link ViolationsWrapper}.
* @param currentSelectedEdge the {@link SDGEdge} you want to mark as disproven.
* @throws IllegalArgumentException
*/
public void markAsDisproved(SDGEdge currentSelectedEdge) throws IllegalArgumentException{
if(currentSelectedEdge == null) {
throw new IllegalArgumentException("No method selected!");
......@@ -132,11 +145,19 @@ public class JoanaKeYInterfacer {
this.useSlicedFiles = selected;
}
/**
* set method inlining option for the disproving process
* @param selected true, if you want to use method inlining
*/
public void setUseMethodInlining(boolean selected) {
this.useMethodInlining = selected;
javaForKeyCreator.setMethodInlining(selected);
}
/**
* set loop unwinding option for the disproving process
* @param selected true, if you want to use loop unwinding
*/
public void setUseLoopUnwinding(boolean selected) {
this.useLoopUnwinding = selected;
javaForKeyCreator.setUseLoopUnwinding(selected);
......
......@@ -37,7 +37,7 @@ import keyjoana.util.FilesUtil;
/**
*
* @author holger
* @author holger,joachim
*/
public class MainWindowController implements Initializable, SettingsObserver {
......@@ -282,6 +282,7 @@ public class MainWindowController implements Initializable, SettingsObserver {
});
}
@SuppressWarnings("unused")
@Deprecated
private void reloadLastFile() {
if (lastFileLoaded == null) {
......@@ -340,9 +341,7 @@ public class MainWindowController implements Initializable, SettingsObserver {
keyJoanaSettings.addSettingObserver(settingsManager);
keyJoanaSettings.addSettingObserver(this);
settingsManager.loadSettings();
//TODO: load settings from file with settingsmanager
//TODO: remove boolean settings (loopundwind, method expand, slicing, and use keyJoanaSettings instead
disproHandler = new DisproHandler(actionLogger, labelProjName, labelSummaryEdge, labelSomeOtherData,
menuBarMain, listViewUncheckedEdges, listViewUncheckedChops, listViewCalledMethodsOfSE,
listViewLoopsOfSE, listViewFormalInoutPairs, anchorPaneMethodCode, anchorPaneLoopInvariant,
......
......@@ -9,7 +9,7 @@ import java.util.ArrayList;
/**
* this class manages the recently loaded files
* @author joachim muessig
* @author joachim
*
*/
public class RecentlyUsedFilesManager {
......@@ -93,7 +93,6 @@ public class RecentlyUsedFilesManager {
if (recentlyUsedFiles.size() > maxNumberOfSavedRecentlyLoadedFiles) {
recentlyUsedFiles.remove(recentlyUsedFiles.size()-1);
}
//TODO:Update list/stack/array for the recently loaded file
//Update mostRecentlyUsedFile
//store new content in the File for recently loaded files
try {
......
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