Commit 3daeb5af authored by Christian Meyer's avatar Christian Meyer
Browse files

Launcher.java: fixed issue of first output folder being empty

        in batch mode
parent 30c83186
......@@ -93,16 +93,8 @@ public class Launcher {
ZmtSimState simState = createSimState(args, context.classLocator);
Class<? extends SimParams> paramsClass = simState.getParamsClass();
SimParams defaultParams = createDefaultParams(paramsClass);
Mode mode = args.getMode();
ParamsUtil.getXStreamInstance().processAnnotations(paramsClass);
if (mode != null) {
Path outputPath = context.outputPathGenerator
.createPaths(simState.getClass(), mode, getWorkingDirectory()).iterator().next();
simState.setOutputPath(outputPath);
}
// export parameters if needed
try {
if (args.getExportAutoParamsPath() != null) {
......@@ -234,13 +226,30 @@ public class Launcher {
}
/**
* Creates the output path for non-batch runs.
*
* @author mey
*
*/
private abstract class NonBatchProcessor extends LoadParamsProcessor {
@Override
protected void process(LauncherArgs args, ZmtSimState simState) {
Path outputPath = context.outputPathGenerator
.createPaths(simState.getClass(), args.getMode(), getWorkingDirectory()).iterator().next();
simState.setOutputPath(outputPath);
}
}
/**
* Runs simulation for a single time.
*
* @author mey
*
*/
private class SingleProcessor extends LoadParamsProcessor {
private class SingleProcessor extends NonBatchProcessor {
@Override
protected void process(LauncherArgs args, ZmtSimState simState) {
context.simulationLooper.loop(simState, args.getSimTime(), args.getPrintStatusInterval());
......@@ -253,7 +262,7 @@ public class Launcher {
* @author mey
*
*/
private class GuiProcessor extends LoadParamsProcessor {
private class GuiProcessor extends NonBatchProcessor {
@Override
protected void process(LauncherArgs args, final ZmtSimState simState) {
Class<? extends ZmtGUIState> guiStateClass;
......
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