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

Fixes and remove old constructors

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