Commit 39ab2c49 authored by Jakob Schöttl's avatar Jakob Schöttl

Merge branch 'simulation' into 'develop'

Split Scenario and ScenarioRun classes



See merge request !20
parents e37b9646 d0b4615c
......@@ -23,7 +23,7 @@ import org.vadere.gui.components.control.ReflectionAttributeModifier;
import org.vadere.gui.components.model.IDefaultModel;
import org.vadere.gui.projectview.view.JsonValidIndicator;
import org.vadere.gui.projectview.view.ProjectView;
import org.vadere.gui.projectview.view.ScenarioJPanel;
import org.vadere.gui.projectview.view.ScenarioPanel;
import org.vadere.gui.topographycreator.model.AgentWrapper;
import org.vadere.gui.topographycreator.model.TopographyCreatorModel;
import org.vadere.state.attributes.Attributes;
......@@ -144,12 +144,12 @@ public class ScenarioElementView extends JPanel implements ISelectScenarioElemen
try {
Attributes attributes = StateJsonConverter.deserializeScenarioElementType(json, element.getType());
ReflectionAttributeModifier.setAttributes(element, attributes);
ScenarioJPanel.removeJsonParsingErrorMsg();
ScenarioPanel.removeJsonParsingErrorMsg();
ProjectView.getMainWindow().refreshScenarioNames();
jsonValidIndicator.setValid();
((TopographyCreatorModel) panelModel).getScenario().updateCurrentStateSerialized(); // casting should be safe her because in the other two modes (onlineVis and postVis), updateModel() won't be called because it's set to uneditable
} catch (IOException e) {
ScenarioJPanel.setActiveJsonParsingErrorMsg("TOPOGRAPHY CREATOR tab:\n" + e.getMessage()); // add name of scenario element?
ScenarioPanel.setActiveJsonParsingErrorMsg("TOPOGRAPHY CREATOR tab:\n" + e.getMessage()); // add name of scenario element?
jsonValidIndicator.setInvalid();
}
}
......
......@@ -7,7 +7,7 @@ import org.vadere.gui.components.utils.Resources;
import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.model.PostvisualizationModel;
import org.vadere.gui.postvisualization.view.DialogFactory;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.io.IOOutput;
import org.vadere.util.io.IOUtils;
......@@ -81,7 +81,7 @@ public class ActionOpenFile extends ActionVisualization {
IOUtils.getFirstFile(scenarioOutputDir, IOUtils.SCENARIO_FILE_EXTENSION);
if (trajectoryFile.isPresent() && snapshotFile.isPresent()) {
ScenarioRunManager vadere = IOOutput.readScenario(snapshotFile.get().toPath());
Scenario vadere = IOOutput.readScenario(snapshotFile.get().toPath());
model.init(IOOutput.readTrajectories(trajectoryFile.get().toPath(), vadere), vadere, trajectoryFile.get().getParent());
model.notifyObservers();
dialog.dispose();
......
......@@ -18,7 +18,7 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.model.SimulationModel;
import org.vadere.gui.postvisualization.utils.PotentialFieldContainer;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.state.scenario.Agent;
import org.vadere.state.scenario.Pedestrian;
import org.vadere.state.scenario.ScenarioElement;
......@@ -41,7 +41,7 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
private int topographyId;
private ScenarioRunManager vadere;
private Scenario vadere;
private PotentialFieldContainer potentialContainer;
......@@ -65,7 +65,7 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
super(new PostvisualizationConfig());
this.trajectories = new HashMap<>();
this.agentsByStep = new HashMap<>();
this.vadere = new ScenarioRunManager("");
this.vadere = new Scenario("");
this.topographyId = 0;
this.colorEvalFunctions = new HashMap<>();
this.potentialContainer = null;
......@@ -98,7 +98,7 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
});
}
public void init(final Map<Step, List<Agent>> agentsByStep, final ScenarioRunManager vadere, final String projectPath) {
public void init(final Map<Step, List<Agent>> agentsByStep, final Scenario vadere, final String projectPath) {
logger.info("start init postvis model");
init(vadere, projectPath);
this.agentsByStep = agentsByStep;
......@@ -136,7 +136,7 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
logger.info("finished init postvis model");
}
public void init(final ScenarioRunManager vadere, final String projectPath) {
public void init(final Scenario vadere, final String projectPath) {
this.vadere = vadere;
this.agentsByStep = new HashMap<>();
this.steps = new ArrayList<>();
......@@ -161,7 +161,7 @@ public class PostvisualizationModel extends SimulationModel<PostvisualizationCon
}
}
public ScenarioRunManager getScenarioRunManager() {
public Scenario getScenarioRunManager() {
return vadere;
}
......
......@@ -17,7 +17,7 @@ import org.vadere.gui.postvisualization.PostVisualisation;
import org.vadere.gui.postvisualization.control.*;
import org.vadere.gui.postvisualization.model.PostvisualizationModel;
import org.vadere.gui.projectview.control.ActionDeselect;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.io.HashGenerator;
import org.vadere.simulator.projects.io.IOOutput;
import org.vadere.util.io.IOUtils;
......@@ -326,13 +326,13 @@ public class PostvisualizationWindow extends JPanel implements Observer {
return menuBar;
}
public void loadOutputFile(final File trajectoryFile, final ScenarioRunManager scenario) throws IOException {
public void loadOutputFile(final File trajectoryFile, final Scenario scenario) throws IOException {
Player.getInstance(model).stop();
model.init(IOOutput.readTrajectories(trajectoryFile.toPath(), scenario), scenario, trajectoryFile.getParent());
model.notifyObservers();
}
public void loadOutputFile(final ScenarioRunManager scenario) throws IOException {
public void loadOutputFile(final Scenario scenario) throws IOException {
Player.getInstance(model).stop();
model.init(scenario, model.getOutputPath());
model.notifyObservers();
......
......@@ -4,7 +4,7 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.ProjectWriter;
import org.vadere.util.io.IOUtils;
......@@ -42,7 +42,7 @@ public abstract class ActionAbstractAddScenario extends AbstractAction {
if (isScenarioNameValid(scenarioName)) {
try {
ScenarioRunManager vadere = generateVadere(scenarioName);
Scenario vadere = generateVadere(scenarioName);
if (vadere == null) // e.g. canceled by user
return;
addScenario(vadere);
......@@ -59,9 +59,9 @@ public abstract class ActionAbstractAddScenario extends AbstractAction {
return !model.isScenarioNameInConflict(name);
}
protected abstract ScenarioRunManager generateVadere(final String name) throws IOException;
protected abstract Scenario generateVadere(final String name) throws IOException;
protected void addScenario(final ScenarioRunManager scenarioRM) throws IOException {
protected void addScenario(final Scenario scenarioRM) throws IOException {
ProjectWriter.writeScenarioFileJson(model.getCurrentProjectPath(), scenarioRM);
model.addScenario(scenarioRM);
logger.info("add scenario: " + scenarioRM);
......
......@@ -3,14 +3,14 @@ package org.vadere.gui.projectview.control;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.dataprocessing.DataProcessingJsonManager;
import org.vadere.state.scenario.Topography;
import java.io.IOException;
/**
* Add a new and fresh {@link org.vadere.simulator.projects.ScenarioRunManager} scenario to the
* Add a new and fresh {@link org.vadere.simulator.projects.Scenario} scenario to the
* {@link org.vadere.simulator.projects.VadereProject} project.
*
*/
......@@ -27,8 +27,8 @@ public class ActionAddScenario extends ActionAbstractAddScenario {
}
@Override
protected ScenarioRunManager generateVadere(final String name) throws IOException {
ScenarioRunManager newScenario = new ScenarioRunManager(name);
protected Scenario generateVadere(final String name) throws IOException {
Scenario newScenario = new Scenario(name);
newScenario.setDataProcessingJsonManager(DataProcessingJsonManager.createDefault());
if (topography != null) {
newScenario.setTopography(topography);
......
......@@ -5,7 +5,7 @@ import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.simulator.projects.ProjectWriter;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import java.awt.event.ActionEvent;
import java.io.IOException;
......@@ -27,8 +27,8 @@ public class ActionCloneScenario extends AbstractAction {
public void actionPerformed(final ActionEvent event) {
ProjectViewModel.ScenarioBundle optionalScenarioBundle = model.getSelectedScenarioBundle();
ScenarioRunManager scenario = optionalScenarioBundle.getScenario();
ScenarioRunManager clonedScenario = scenario.clone();
Scenario scenario = optionalScenarioBundle.getScenario();
Scenario clonedScenario = scenario.clone();
String name = scenario.getName() + "_" + Messages.getString("Clone.text") + "_";
int index = 1;
while (model.isScenarioNameInConflict(name + index)) {
......
......@@ -5,7 +5,7 @@ import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.view.ProjectView;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import java.awt.*;
import java.awt.event.ActionEvent;
......@@ -27,7 +27,7 @@ public class ActionEditScenarioDescription extends AbstractAction {
@Override
public void actionPerformed(final ActionEvent e) {
ScenarioRunManager scenario = model.getSelectedScenarioBundle().getScenario();
Scenario scenario = model.getSelectedScenarioBundle().getScenario();
JTextArea textArea = new JTextArea(scenario.getDescription());
JScrollPane scrollPane = new JScrollPane(textArea);
......
......@@ -4,7 +4,7 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.io.IOVadere;
import org.vadere.util.io.IOUtils;
......@@ -15,7 +15,7 @@ import java.io.IOException;
/**
* Ask the user to select a scenario-file from an output directory to convert this file to a
* {@link org.vadere.simulator.projects.ScenarioRunManager} scenario.
* {@link org.vadere.simulator.projects.Scenario} scenario.
*
*/
public class ActionGenerateScenarioFromOutputFile extends ActionAbstractAddScenario {
......@@ -36,7 +36,7 @@ public class ActionGenerateScenarioFromOutputFile extends ActionAbstractAddScena
}
@Override
protected ScenarioRunManager generateVadere(final String name) throws IOException {
protected Scenario generateVadere(final String name) throws IOException {
try {
FileFilter filter = new FileNameExtensionFilter("Scenario", IOUtils.SCENARIO_FILE_EXTENSION);
String path =
......@@ -44,7 +44,7 @@ public class ActionGenerateScenarioFromOutputFile extends ActionAbstractAddScena
if (path == null) {
return null;
}
ScenarioRunManager vadere = IOVadere.fromJson(IOUtils.readTextFile(path));
Scenario vadere = IOVadere.fromJson(IOUtils.readTextFile(path));
vadere.setName(name);
return vadere;
} catch (IOException e) {
......
......@@ -4,12 +4,12 @@ import java.io.IOException;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.model.ProjectViewModel.OutputBundle;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.io.IOOutput;
/**
* Converts a selected output directory to a
* {@link org.vadere.simulator.projects.ScenarioRunManager} scenario.
* {@link org.vadere.simulator.projects.Scenario} scenario.
*
*/
public class ActionOutputToScenario extends ActionAbstractAddScenario {
......@@ -23,9 +23,9 @@ public class ActionOutputToScenario extends ActionAbstractAddScenario {
}
@Override
protected ScenarioRunManager generateVadere(final String name) throws IOException {
protected Scenario generateVadere(final String name) throws IOException {
OutputBundle bundle = model.getSelectedOutputBundle();
ScenarioRunManager scenarioRM = IOOutput.readScenario(bundle.getDirectory());
Scenario scenarioRM = IOOutput.readScenario(bundle.getDirectory());
scenarioRM.setName(name);
return scenarioRM;
}
......
......@@ -5,7 +5,7 @@ import org.apache.log4j.Logger;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.model.VadereScenarioTableModel;
import org.vadere.gui.projectview.model.VadereState;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import javax.swing.*;
import java.awt.event.ActionEvent;
......@@ -25,7 +25,7 @@ public class ActionPauseScenario extends AbstractAction {
@Override
public void actionPerformed(final ActionEvent e) {
ProjectViewModel.ScenarioBundle optionalScenarioBundle = model.getRunningScenario();
ScenarioRunManager scenario = optionalScenarioBundle.getScenario();
Scenario scenario = optionalScenarioBundle.getScenario();
if (model.getProject().isScenarioPaused()) {
model.getProject().resumePausedScenarios();
model.getScenarioTableModel().replace(scenario,
......
......@@ -6,7 +6,7 @@ import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.model.VadereScenarioTableModel;
import org.vadere.gui.projectview.model.VadereState;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.ProjectWriter;
import javax.swing.*;
......@@ -30,7 +30,7 @@ public class ActionRenameScenario extends AbstractAction {
ProjectViewModel.ScenarioBundle optionalScenarioBundle = model.getSelectedScenarioBundle();
ScenarioRunManager scenario = optionalScenarioBundle.getScenario();
Scenario scenario = optionalScenarioBundle.getScenario();
String oldName = optionalScenarioBundle.getScenario().getName();
String newName =
JOptionPane.showInputDialog(null, Messages.getString("listMenuRenameButtonAction.title"), oldName);
......
......@@ -5,7 +5,7 @@ import org.apache.log4j.Logger;
import org.vadere.gui.projectview.model.ProjectViewModel;
import org.vadere.gui.projectview.model.ProjectViewModel.OutputBundle;
import org.vadere.simulator.control.OfflineSimulation;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.io.IOOutput;
import java.awt.event.ActionEvent;
......@@ -33,7 +33,7 @@ public class ActionRunOutput extends AbstractAction {
String directoryName = outputBundle.getDirectory().getName();
try {
ScenarioRunManager vadere =
Scenario vadere =
IOOutput.readScenarioRunManager(outputBundle.getProject(), directoryName);
OfflineSimulation offlineSimulation = new OfflineSimulation(
IOOutput.readTrajectories(outputBundle.getProject(), vadere, directoryName),
......
......@@ -6,10 +6,10 @@ import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.projectview.control.IOutputFileRefreshListener;
import org.vadere.gui.projectview.control.IProjectChangeListener;
import org.vadere.gui.projectview.view.ProjectView;
import org.vadere.gui.projectview.view.ScenarioJPanel;
import org.vadere.gui.projectview.view.ScenarioPanel;
import org.vadere.gui.projectview.view.VDialogManager;
import org.vadere.gui.projectview.view.VTable;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.VadereProject;
import org.vadere.simulator.projects.ProjectWriter;
import org.vadere.simulator.projects.io.IOOutput;
......@@ -24,7 +24,7 @@ public class ProjectViewModel {
private static Logger logger = LogManager.getLogger(ProjectViewModel.class);
private VadereProject project;
private ScenarioRunManager currentScenario;
private Scenario currentScenario;
private final OutputFileTableModel outputTableModel;
private final VadereScenarioTableModel scenarioTableModel;
......@@ -89,13 +89,13 @@ public class ProjectViewModel {
});
}
public void saveScenarioToDisk(ScenarioRunManager scenario) throws IOException {
public void saveScenarioToDisk(Scenario scenario) throws IOException {
ProjectWriter.writeScenarioFileJson(getCurrentProjectPath(), scenario);
scenario.saveChanges();
}
private List<ScenarioRunManager> getScenariosByRows(final int[] rows) {
List<ScenarioRunManager> scenarios = new ArrayList<>();
private List<Scenario> getScenariosByRows(final int[] rows) {
List<Scenario> scenarios = new ArrayList<>();
Arrays.stream(rows).boxed() // TODO code [priority=medium] [task=refactoring] copied from deleteScenarios(), might be possible simpler?
.sorted((row1, row2) -> row2 - row1)
.map(i -> getScenarioTableModel().getValue(i))
......@@ -105,13 +105,13 @@ public class ProjectViewModel {
}
public boolean selectedScenariosContainChangedOnes(final int[] rows) {
for (ScenarioRunManager srm : getScenariosByRows(rows))
for (Scenario srm : getScenariosByRows(rows))
if (srm.hasUnsavedChanges())
return true;
return false;
}
private void deleteScenario(final ScenarioRunManager scenario) {
private void deleteScenario(final Scenario scenario) {
try {
ProjectWriter.deleteScenario(scenario, getCurrentProjectPath());
getProject().removeScenario(scenario);
......@@ -136,7 +136,7 @@ public class ProjectViewModel {
refreshOutputThread.start();
}
public void addScenario(final ScenarioRunManager scenario) {
public void addScenario(final Scenario scenario) {
project.addScenario(scenario);
getScenarioTableModel()
.insertValue(new VadereScenarioTableModel.VadereDisplay(scenario, VadereState.INITIALIZED));
......@@ -197,29 +197,29 @@ public class ProjectViewModel {
public OutputBundle getSelectedOutputBundle() throws IOException {
File directory = outputTableModel.getValue(outputTable.getSelectedRow());
ScenarioRunManager scenarioRM = IOOutput.readScenarioRunManager(project, directory.getName());
Scenario scenarioRM = IOOutput.readScenarioRunManager(project, directory.getName());
return new OutputBundle(directory, project, IOOutput.listSelectedOutputDirs(project, scenarioRM));
}
public ScenarioBundle getRunningScenario() {
ScenarioRunManager scenarioRM = project.getCurrentScenario();
Scenario scenarioRM = project.getCurrentScenario();
List<String> outputDirectories = IOOutput.listSelectedOutputDirs(project, scenarioRM)
.stream().map(file -> file.getAbsolutePath()).collect(Collectors.toList());
return new ScenarioBundle(project, scenarioRM, outputDirectories);
}
public ScenarioBundle getSelectedScenarioBundle() {
ScenarioRunManager scenarioRM = getSelectedScenarioRunManager();
Scenario scenarioRM = getSelectedScenarioRunManager();
List<String> outputDirectories = IOOutput.listSelectedOutputDirs(project, scenarioRM)
.stream().map(file -> file.getAbsolutePath()).collect(Collectors.toList());
return new ScenarioBundle(project, scenarioRM, outputDirectories);
}
private ScenarioRunManager getSelectedScenarioRunManager() {
private Scenario getSelectedScenarioRunManager() {
return scenarioTableModel.getValue(scenarioTable.getSelectedRow()).scenarioRM;
}
public Collection<ScenarioRunManager> getScenarios(final int[] rows) {
public Collection<Scenario> getScenarios(final int[] rows) {
return Arrays.stream(rows)
.boxed()
.map(i -> getScenarioTableModel().getValue(i))
......@@ -277,11 +277,11 @@ public class ProjectViewModel {
}
public static class ScenarioBundle {
private final ScenarioRunManager scenarioRM;
private final Scenario scenarioRM;
private final VadereProject project;
private final Collection<String> outputDirectories;
public ScenarioBundle(final VadereProject project, final ScenarioRunManager scenarioRM,
public ScenarioBundle(final VadereProject project, final Scenario scenarioRM,
final Collection<String> outputDirectories) {
this.project = project;
this.scenarioRM = scenarioRM;
......@@ -292,7 +292,7 @@ public class ProjectViewModel {
return outputDirectories;
}
public ScenarioRunManager getScenario() {
public Scenario getScenario() {
return scenarioRM;
}
......@@ -349,13 +349,13 @@ public class ProjectViewModel {
}
/** Set selection in scenario JTable. */
public void selectScenario(ScenarioRunManager scenarioRM) {
public void selectScenario(Scenario scenarioRM) {
int i = scenarioTableModel.indexOfRow(scenarioRM);
setSelectedRowIndexInScenarioTable(i);
}
public boolean runScenarioIsOk() {
for (ScenarioRunManager srm : getScenarios(scenarioTable.getSelectedRows())) {
for (Scenario srm : getScenarios(scenarioTable.getSelectedRows())) {
String response = srm.readyToRunResponse();
if (response != null) {
VDialogManager.showMessageDialogWithBodyAndTextArea("Error",
......@@ -365,7 +365,7 @@ public class ProjectViewModel {
}
}
String errorMsg = ScenarioJPanel.getActiveJsonParsingErrorMsg();
String errorMsg = ScenarioPanel.getActiveJsonParsingErrorMsg();
if (errorMsg != null) {
VDialogManager.showMessageDialogWithBodyAndTextArea(
Messages.getString("RunScenarioJsonErrors.title"),
......@@ -384,11 +384,11 @@ public class ProjectViewModel {
}
}
public void setCurrentScenario(ScenarioRunManager scenario) {
public void setCurrentScenario(Scenario scenario) {
this.currentScenario = scenario;
}
public ScenarioRunManager getCurrentScenario() {
public Scenario getCurrentScenario() {
return currentScenario;
}
......
......@@ -3,21 +3,21 @@ package org.vadere.gui.projectview.model;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.vadere.gui.components.utils.Messages;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.VadereProject;
/**
* The table panelModel used in the table that displays
* {@link org.vadere.simulator.projects.ScenarioRunManager}s.
* {@link org.vadere.simulator.projects.Scenario}s.
*
*/
public class VadereScenarioTableModel extends VadereTableModelSorted<VadereScenarioTableModel.VadereDisplay> {
public static class VadereDisplay {
public final ScenarioRunManager scenarioRM;
public final Scenario scenarioRM;
public final VadereState state;
public VadereDisplay(final ScenarioRunManager scenarioRM, final VadereState state) {
public VadereDisplay(final Scenario scenarioRM, final VadereState state) {
this.scenarioRM = scenarioRM;
this.state = state;
}
......@@ -60,7 +60,7 @@ public class VadereScenarioTableModel extends VadereTableModelSorted<VadereScena
.forEach(scenario -> insertValue(new VadereDisplay(scenario, VadereState.INITIALIZED)));
}
public synchronized boolean replace(final ScenarioRunManager oldValue, final VadereDisplay newValue) {
public synchronized boolean replace(final Scenario oldValue, final VadereDisplay newValue) {
if (remove(oldValue)) {
insertValue(newValue);
fireTableDataChanged();
......@@ -74,14 +74,14 @@ public class VadereScenarioTableModel extends VadereTableModelSorted<VadereScena
return indexOfRow(value.scenarioRM);
}
public synchronized int indexOfRow(final ScenarioRunManager value) {
public synchronized int indexOfRow(final Scenario value) {
for (int i = 0; i < getRowCount(); i++)
if (((ScenarioRunManager) getValueAt(i, 0)).getName().equals(value.getName()))
if (((Scenario) getValueAt(i, 0)).getName().equals(value.getName()))
return i;
throw new RuntimeException("Can't find row in scenarioTable corresponding to scenario " + value.getName()); // if we'd return -1 as before, this throws in-thread errors that are difficult to debug because of the lack of a stacktrace!
}
public synchronized boolean remove(final ScenarioRunManager value) {
public synchronized boolean remove(final Scenario value) {
return super.remove(new VadereDisplay(value, VadereState.INITIALIZED));
}
......
......@@ -58,7 +58,7 @@ import org.fife.ui.rsyntaxtextarea.Theme;
import org.vadere.gui.components.utils.Messages;
import org.vadere.gui.components.view.JComboCheckBox;
import org.vadere.gui.projectview.utils.ClassFinder;
import org.vadere.simulator.projects.ScenarioRunManager;
import org.vadere.simulator.projects.Scenario;
import org.vadere.simulator.projects.dataprocessing.DataProcessingJsonManager;
import org.vadere.simulator.projects.dataprocessing.outputfile.OutputFile;
import org.vadere.simulator.projects.dataprocessing.processor.DataProcessor;
......@@ -84,7 +84,7 @@ class DataProcessingView extends JPanel implements IJsonView {
private static final String jsonViewMode = "json";
private boolean inGuiViewMode = true;
private ScenarioRunManager currentScenario;
private Scenario currentScenario;
private boolean isEditable;
......@@ -180,7 +180,7 @@ class DataProcessingView extends JPanel implements IJsonView {
}