Browse Source

Simulator: Optionally export rewards with path

Provides a switch that allows to specify that reward information
should be included in path export functions, as well as API compatible
forwarding functions.
accumulation-v4.7
Joachim Klein 7 years ago
parent
commit
6a7458fb47
  1. 14
      prism/src/simulator/PathFull.java
  2. 29
      prism/src/simulator/SimulatorEngine.java

14
prism/src/simulator/PathFull.java

@ -499,11 +499,25 @@ public class PathFull extends Path implements PathFullInfo
* @param vars Restrict printing to these variables (indices) and steps which change them (ignore if null)
*/
public void exportToLog(PrismLog log, boolean showTimeCumul, String colSep, ArrayList<Integer> vars) throws PrismException
{
exportToLog(log, showTimeCumul, false, colSep, vars);
}
/**
* Export path to a PrismLog (e.g. file, stdout).
* @param log PrismLog to which the path should be exported to.
* @param showTimeCumul Show time in cumulative form?
* @param showRewards Show rewards?
* @param colSep String used to separate columns in display
* @param vars Restrict printing to these variables (indices) and steps which change them (ignore if null)
*/
public void exportToLog(PrismLog log, boolean showTimeCumul, boolean showRewards, String colSep, ArrayList<Integer> vars) throws PrismException
{
PathToText displayer = new PathToText(log, modulesFile);
displayer.setShowTimeCumul(showTimeCumul);
displayer.setColSep(colSep);
displayer.setVarsToShow(vars);
displayer.setShowRewards(showRewards);
display(displayer);
}

29
prism/src/simulator/SimulatorEngine.java

@ -1325,7 +1325,18 @@ public class SimulatorEngine extends PrismComponent
*/
public void exportPath(File file) throws PrismException
{
exportPath(file, false, " ", null);
exportPath(file, false);
}
/**
* Export the current path to a file in a simple space separated format.
* (Not applicable for on-the-fly paths)
* @param file File to which the path should be exported to (mainLog if null).
* @param showRewards Export reward information with the path
*/
public void exportPath(File file, boolean showRewards) throws PrismException
{
exportPath(file, false, showRewards, " ", null);
}
/**
@ -1337,6 +1348,20 @@ public class SimulatorEngine extends PrismComponent
* @param vars Restrict printing to these variables (indices) and steps which change them (ignore if null)
*/
public void exportPath(File file, boolean timeCumul, String colSep, ArrayList<Integer> vars) throws PrismException
{
exportPath(file, timeCumul, false, colSep, vars);
}
/**
* Export the current path to a file.
* (Not applicable for on-the-fly paths)
* @param file File to which the path should be exported to (mainLog if null).
* @param timeCumul Show time in cumulative form?
* @param showRewards Export reward information with the path
* @param colSep String used to separate columns in display
* @param vars Restrict printing to these variables (indices) and steps which change them (ignore if null)
*/
public void exportPath(File file, boolean timeCumul, boolean showRewards, String colSep, ArrayList<Integer> vars) throws PrismException
{
PrismLog log = null;
try {
@ -1353,7 +1378,7 @@ public class SimulatorEngine extends PrismComponent
log = mainLog;
log.println();
}
((PathFull) path).exportToLog(log, timeCumul, colSep, vars);
((PathFull) path).exportToLog(log, timeCumul, showRewards, colSep, vars);
if (file != null)
log.close();
} finally {

Loading…
Cancel
Save