Browse Source

Fixes/improvement/consistency for results export.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@4474 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 14 years ago
parent
commit
8d1cd55711
  1. 17
      prism/src/prism/PrismCL.java
  2. 16
      prism/src/prism/ResultsCollection.java
  3. 7
      prism/src/userinterface/properties/computation/ExportResultsThread.java

17
prism/src/prism/PrismCL.java

@ -498,18 +498,27 @@ public class PrismCL
if (!exportResultsFilename.equals("stdout"))
mainLog.println("to file \"" + exportResultsFilename + "\"...");
else
mainLog.println("below:");
mainLog.println("below:\n");
PrismFileLog tmpLog = new PrismFileLog(exportResultsFilename);
if (!tmpLog.ready()) {
errorAndExit("Couldn't open file \"" + exportResultsFilename + "\" for output");
}
boolean csv = false;
String sep = csv ? ", " : "\t";
for (i = 0; i < numPropertiesToCheck; i++) {
if (i > 0)
tmpLog.println();
if (exportresultsmatrix) {
tmpLog.print(results[i].toStringMatrix("\t"));
if (numPropertiesToCheck > 1) {
if (sep.equals(", "))
tmpLog.print("\"" + propertiesToCheck.get(i) + ":\"\n");
else
tmpLog.print(propertiesToCheck.get(i) + ":\n");
}
if (!exportresultsmatrix) {
tmpLog.println(results[i].toString(false, sep, sep));
} else {
tmpLog.print(propertiesToCheck.get(i) + ":\n" + results[i].toString(false, " ", " "));
tmpLog.println(results[i].toStringMatrix(sep));
}
}
tmpLog.close();

16
prism/src/prism/ResultsCollection.java

@ -438,7 +438,11 @@ public class ResultsCollection
*/
public String toString(boolean pv, String sep, String eq)
{
return toStringRec(pv, sep, eq, "");
String ret = toStringRec(pv, sep, eq, "");
// Strip off last \n before returning
if (ret.charAt(ret.length() - 1) == '\n')
ret = ret.substring(0, ret.length() - 1);
return ret;
}
public String toStringRec(boolean pv, String sep, String eq, String head)
@ -536,13 +540,13 @@ public class ResultsCollection
if (rangingConstants.size() - level == 2)
res += constant.getValue(i);
res += kids[i].toStringMatrixRec(sep);
// Print new line after row
if (rangingConstants.size() - level == 2)
// Print new line after row (except last one)
if ((rangingConstants.size() - level == 2) && i < n - 1)
res += "\n";
// Print gaps between matrices (except last one)
if ((rangingConstants.size() - level > 2) && i < n - 1)
res += "\n\n";
}
// Print gaps between matrices
if (rangingConstants.size() - level == 2)
res += "\n";
return res;
}

7
prism/src/userinterface/properties/computation/ExportResultsThread.java

@ -89,7 +89,8 @@ public class ExportResultsThread extends Thread
PrintWriter out = new PrintWriter(new FileWriter(f));
n = exps.length;
for (i = 0; i < n; i++) {
if (i > 0) out.print("\n");
if (i > 0)
out.println();
if (n > 1) {
if (sep.equals(", "))
out.print("\"" + exps[i].getPropertyString() + ":\"\n");
@ -97,9 +98,9 @@ public class ExportResultsThread extends Thread
out.print(exps[i].getPropertyString() + ":\n");
}
if (!exportMatrix) {
out.print(exps[i].getResults().toString(false, sep, sep));
out.println(exps[i].getResults().toString(false, sep, sep));
} else {
out.print(exps[i].getResults().toStringMatrix(sep));
out.println(exps[i].getResults().toStringMatrix(sep));
}
}
out.flush();

Loading…
Cancel
Save