Commit edc0ad78 authored by Marion Goedel's avatar Marion Goedel
Browse files

Revert "Changes in VadereConsole to allow for option -suq as preparation for the SUQ controller."

This reverts commit 7b1da6cf.
parent 5a19433b
Pipeline #63287 failed with stages
......@@ -5,7 +5,6 @@ import org.vadere.simulator.projects.io.IOVadere;
import org.vadere.util.io.IOUtils;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
public class ScenarioFactory {
......@@ -32,22 +31,4 @@ public class ScenarioFactory {
return scenario;
}
public static Scenario createScenarioWithScenarioFilePath(
final Path scenarioPath) throws IOException {
String json = IOUtils.readTextFile(scenarioPath);
Scenario scenario = IOVadere.fromJson(json);
return scenario;
}
public static Scenario createScenarioWithScenarioJson(
final String scenarioJson) throws IOException {
Scenario scenario = IOVadere.fromJson(scenarioJson);
return scenario;
}
}
......@@ -40,18 +40,9 @@ public class VadereConsole {
System.exit(1);
}
System.out.println(System.getProperty("user.dir"));
Locale.setDefault(Locale.ENGLISH);
String pathToScenarioFile = ns.getString("scenario-file");
String outputDir = ns.get("output-dir");
if (ns.getBoolean("suq")){
if (outputDir == null){
throw new IllegalArgumentException("If the option -suq is activated, an output directory (output-dir) has to be specified!");
}
}
if (pathToScenarioFile == null) {
System.err.println("Too few arguments. Exiting.");
......@@ -70,26 +61,12 @@ public class VadereConsole {
logger.info(String.format("Running VADERE on %s...", scenarioFilePath));
try {
Scenario scenario;
if (ns.getBoolean("suq")) {
scenario = ScenarioFactory.createScenarioWithScenarioFilePath(Paths.get(scenarioFile));
}else{
scenario = ScenarioFactory.createVadereWithProjectDirectory(scenarioFile, projectDirectory);
}
Scenario scenario = ScenarioFactory.createVadereWithProjectDirectory(projectDirectory,scenarioFile);
if(outputDir != null) {
if (ns.getBoolean("suq")){
new ScenarioRun(scenario, outputDir, null,true).run();
}else {
new ScenarioRun(scenario, outputDir, null).run();
}
new ScenarioRun(scenario, outputDir,null).run();
}
else {
if (ns.getBoolean("suq")){
new ScenarioRun(scenario, null, null,true).run();
}else {
new ScenarioRun(scenario, null).run();
}
new ScenarioRun(scenario, null).run();
}
} catch (Exception e) {
......@@ -106,9 +83,6 @@ public class VadereConsole {
.help("Path to the scenario file.");
parser.addArgument("output-dir").required(false)
.help("Path to the directory of the output. By default this is ./output of the directory of the executable.");
parser.addArgument("-suq").required(false)
.help("Indicates that the folder structure for input and output is fully controlled by the user. Only a single scenario is run, no project or project structure is necessary. Intended for the SUQ-Controller. Outputpath has to be specified!")
.action(Arguments.storeTrue());
return parser;
}
......
......@@ -53,16 +53,11 @@ public class ScenarioRun implements Runnable {
this(scenario, IOUtils.OUTPUT_DIR, scenarioFinishedListener);
}
public ScenarioRun(final Scenario scenario, final String outputDir, final RunnableFinishedListener scenarioFinishedListener) {
this(scenario, outputDir, scenarioFinishedListener, false);
}
public ScenarioRun(final Scenario scenario, final String outputDir, final RunnableFinishedListener scenarioFinishedListener, boolean suq) {
this.scenario = scenario;
this.scenarioStore = scenario.getScenarioStore();
this.dataProcessingJsonManager = scenario.getDataProcessingJsonManager();
this.setOutputPaths(Paths.get(outputDir), suq); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/outputs
this.setOutputPaths(Paths.get(outputDir)); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/output
this.finishedListener = scenarioFinishedListener;
}
......@@ -143,15 +138,6 @@ public class ScenarioRun implements Runnable {
}
}
public void setOutputPaths(final Path outputPath, boolean suq) {
if (suq == false){
setOutputPaths(outputPath);
}else{
this.outputPath = Paths.get(outputPath.toString());
System.out.println(this.outputPath);
}
}
public void pause() {
if (simulation != null) { // TODO throw an illegal state exception if simulation is not running
simulation.pause();
......
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