Commit 505ee23e authored by Joachim Müssig's avatar Joachim Müssig

clear up code, javadoc

parent 593fe1a9
......@@ -6,13 +6,10 @@ import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;
import org.antlr.runtime.BufferedTokenStream;
import org.antlr.runtime.TokenSource;
import org.antlr.v4.runtime.ANTLRInputStream;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.Token;
import antlr.TokenStreamBasicFilter;
import joanakey.antlr.java8.Java8BaseListener;
import joanakey.antlr.java8.Java8Lexer;
......
......@@ -216,8 +216,7 @@ public class ViolationsWrapper {
JSONArray violArr = jSONObject.getJSONArray(VIOLATIONS);
created.uncheckedViolations = ViolationsSaverLoader.generateFromJSON(violArr, sdg);
//TODO: set allViolationsToCheck for .dispro load
//TODO: maybe add a json field for allViolations
//TODO: maybe add a json field for allViolations to show all already disproven violations after loading a .dispro file
List<IViolation<SecurityNode>> c = new ArrayList<>();
for (IViolation<SecurityNode> v : created.uncheckedViolations) {
c.add(v);
......
package keyjoana.settings;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Observer;
import java.util.Properties;
/**
* a class for the basic settings
* @author joachim muessig
* a class for the basic settings, containing loop unwinding, method inlining and slicing
* @author joachim
*
*/
public class KeyJoanaSettings implements ObservableSetting {
/**
* settings
*/
public boolean useLoopUnwinding = false;
public boolean useMethodExpand = false;
public boolean useSlicing = false;
private ArrayList<SettingsObserver> settingsObserver = new ArrayList<SettingsObserver>();
private static final String LOOP_UNWIND = "[KeYJoanaSetting]loopUnwind";
private static final String USE_METHOD_EXPAND = "[KeYJoanaSetting]methodExpand";
private static final String USE_SLICING = "[KeYJoanaSetting]useSlicing";
private static final String FALSE = "false";
private static final String TRUE = "true";
// private static final String FALSE = "false";
@Override
public void addSettingObserver(SettingsObserver o) {
......@@ -35,8 +38,9 @@ public class KeyJoanaSettings implements ObservableSetting {
}
/**
* save settings contained in the given {@link Properties} object.
* save settings to this object, contained in the given {@link Properties} object.
* use {@link notifySettingObserver} to notify all observer of changed settings
* @param p the {@link Properties} object to read
*/
public void readProperties(Properties p) {
useLoopUnwinding = getValueOfProperty(p, LOOP_UNWIND);
......@@ -44,6 +48,10 @@ public class KeyJoanaSettings implements ObservableSetting {
useSlicing = getValueOfProperty(p, USE_SLICING);
}
/**
* generate a {@link Properties} object from the Settings of this object.
* @return {@link Properties} object, containing the settings of this object
*/
public Properties generateProperties() {
Properties p = new Properties();
p.setProperty(LOOP_UNWIND, String.valueOf(useLoopUnwinding));
......@@ -93,6 +101,9 @@ public class KeyJoanaSettings implements ObservableSetting {
notifySettingObserver();
}
/**
* notify the observer of this setting
*/
public void notifySettingObserver() {
for (SettingsObserver observer : settingsObserver) {
observer.notifySettingsChange();
......
......@@ -3,17 +3,14 @@ package keyjoana.settings;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
import keyjoana.util.FilesUtil;
/**
* This class handles all settings files. It can store settings to files and load them from files.
* @author joachim muessig
* @author joachim
*
*/
public class SettingsManager implements SettingsObserver{
......@@ -108,6 +105,9 @@ public class SettingsManager implements SettingsObserver{
}
}
/**
* notify message, which will save the settings to the file to make them persistent
*/
@Override
public void notifySettingsChange() {
writeSettingsToFile();
......
package keyjoana.settings;
import java.io.File;
import java.io.IOException;
import keyjoana.util.FilesUtil;
/**
* This class handles the settings filepath and the file for all recently loaded files.
* Class to handle all settings paths or recently loaded file paths
* @author joachim muessig
*
*/
......@@ -16,6 +15,7 @@ public class SettingsPaths {
private static String recentlyLoadedFilesSpecGUI;
private static String settingsDir;
//default directory for all config/settings/recently loaded files
private final static String DIRECTORY_NAME = ".KeYJoana";
static {
......@@ -24,7 +24,8 @@ public class SettingsPaths {
/**
* create the settings directory and update the file path
* @param dir
* This method is optional, the default directory is '.KeYJoana'
* @param dir directory where to save the files
*/
public static void setSettingsDir(String dir) {
settingsDir = dir;
......
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