Commit a64169da authored by Jakob Schöttl's avatar Jakob Schöttl

Fixes and remove old constructors

parent cfe95758
......@@ -14,7 +14,6 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.simulator.control.PassiveCallback;
import org.vadere.simulator.projects.dataprocessing.DataProcessingJsonManager;
import org.vadere.simulator.projects.dataprocessing.ProcessorManager;
import org.vadere.simulator.projects.io.JsonConverter;
import org.vadere.state.attributes.Attributes;
import org.vadere.state.attributes.AttributesSimulation;
......@@ -41,7 +40,6 @@ public class Scenario {
private final List<PassiveCallback> passiveCallbacks;
private DataProcessingJsonManager dataProcessingJsonManager;
private ProcessorManager processorManager;
private ScenarioFinishedListener finishedListener;
private boolean simpleOutputProcessorName = false;
......@@ -97,11 +95,6 @@ public class Scenario {
return null;
}
public void sealAllAttributes() {
scenarioStore.sealAllAttributes();
processorManager.sealAllAttributes();
}
public String getName() {
return scenarioStore.name;
}
......@@ -194,7 +187,6 @@ public class Scenario {
// not all necessary! only the ones that could have changed
scenarioStore = srm.scenarioStore;
dataProcessingJsonManager = srm.dataProcessingJsonManager;
processorManager = srm.processorManager;
finishedListener = srm.finishedListener;
simpleOutputProcessorName = srm.simpleOutputProcessorName;
//this.passiveCallbacks = srm.passiveCallbacks; // is final, can't be reassigned
......@@ -218,10 +210,6 @@ public class Scenario {
return null;
}
public ProcessorManager getProcessorManager() {
return processorManager;
}
public DataProcessingJsonManager getDataProcessingJsonManager() {
return dataProcessingJsonManager;
}
......
......@@ -27,7 +27,7 @@ import org.vadere.state.scenario.Topography;
import org.vadere.util.io.IOUtils;
/**
* Receives an object of type ScenarioStore, manages a scenario and runs the simulation.
* Manages single simulation runs.
*
* @author Jakob Schöttl
*
......@@ -47,37 +47,15 @@ public class ScenarioRun implements Runnable {
private ScenarioFinishedListener finishedListener;
private Simulation simulation;
private Scenario scenario; // TODO make final
private final Scenario scenario;
// TODO remove
@Deprecated
public ScenarioRun(final String name) {
this(name, new ScenarioStore(name));
}
// TODO remove
@Deprecated
public ScenarioRun(final ScenarioStore store) {
this(store.name, store);
}
// TODO remove
@Deprecated
public ScenarioRun(final String name, final ScenarioStore store) {
public ScenarioRun(final Scenario scenario) {
this.scenario = scenario;
this.passiveCallbacks = new LinkedList<>();
this.scenarioStore = store;
this.scenario = null;
this.scenarioStore = scenario.getScenarioStore();
this.dataProcessingJsonManager = new DataProcessingJsonManager();
this.setOutputPaths(Paths.get(IOUtils.OUTPUT_DIR)); // TODO [priority=high] [task=bugfix] [Error?] this is a relative path. If you start the application via eclipse this will be VadereParent/output
}
public ScenarioRun(final Scenario scenario) {
this(scenario.getName(), scenario.getScenarioStore());
this.scenario = scenario;
}
/**
* This method runs a simulation. It must not catch any exceptions! The
......@@ -107,7 +85,7 @@ public class ScenarioRun implements Runnable {
scenario.saveToOutputPath(outputPath);
scenario.sealAllAttributes();
sealAllAttributes();
// Run simulation main loop from start time = 0 seconds
simulation = new Simulation(mainModel, 0, scenarioStore.name, scenarioStore, passiveCallbacks, random, processorManager);
......@@ -272,4 +250,10 @@ public class ScenarioRun implements Runnable {
public Scenario getScenario() {
return scenario;
}
public void sealAllAttributes() {
scenarioStore.sealAllAttributes();
processorManager.sealAllAttributes();
}
}
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