Browse Source

Added printSeparator method to PrismLog.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@4183 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 14 years ago
parent
commit
6eb375c441
  1. 8
      prism/src/prism/PrismCL.java
  2. 8
      prism/src/prism/PrismLog.java
  3. 1
      prism/src/userinterface/GUIComputationThread.java
  4. 7
      prism/src/userinterface/GUIPlugin.java
  5. 10
      prism/src/userinterface/log/GUILog.java
  6. 2
      prism/src/userinterface/model/computation/BuildModelThread.java
  7. 8
      prism/src/userinterface/properties/GUIExperiment.java
  8. 4
      prism/src/userinterface/properties/computation/ModelCheckThread.java
  9. 4
      prism/src/userinterface/properties/computation/SimulateModelCheckThread.java
  10. 3
      prism/src/userinterface/util/GUILogEvent.java

8
prism/src/prism/PrismCL.java

@ -357,7 +357,7 @@ public class PrismCL
// for simulation we can do multiple values of property constants simultaneously // for simulation we can do multiple values of property constants simultaneously
if (simulate && undefinedConstants[j].getNumPropertyIterations() > 1) { if (simulate && undefinedConstants[j].getNumPropertyIterations() > 1) {
try { try {
mainLog.println("\n-------------------------------------------");
mainLog.printSeparator();
mainLog.println("\nSimulating: " + propertiesToCheck.get(j)); mainLog.println("\nSimulating: " + propertiesToCheck.get(j));
if (definedMFConstants != null) if (definedMFConstants != null)
if (definedMFConstants.getNumValues() > 0) if (definedMFConstants.getNumValues() > 0)
@ -391,7 +391,7 @@ public class PrismCL
} }
// log output // log output
mainLog.println("\n-------------------------------------------");
mainLog.printSeparator();
mainLog.println("\n" + (simulate ? "Simulating" : "Model checking") + ": " + propertiesToCheck.get(j)); mainLog.println("\n" + (simulate ? "Simulating" : "Model checking") + ": " + propertiesToCheck.get(j));
if (definedMFConstants != null) if (definedMFConstants != null)
if (definedMFConstants.getNumValues() > 0) if (definedMFConstants.getNumValues() > 0)
@ -705,7 +705,7 @@ public class PrismCL
StateList states; StateList states;
int i; int i;
mainLog.println("\n-------------------------------------------");
mainLog.printSeparator();
// build model // build model
if (!explicit) { if (!explicit) {
@ -1055,7 +1055,7 @@ public class PrismCL
// notify about any warnings // notify about any warnings
int numWarnings = mainLog.getNumberOfWarnings(); int numWarnings = mainLog.getNumberOfWarnings();
if (numWarnings > 0) { if (numWarnings > 0) {
mainLog.println("\n-------------------------------------------");
mainLog.printSeparator();
mainLog.print("\nNote: There "); mainLog.print("\nNote: There ");
if (numWarnings == 1) if (numWarnings == 1)
mainLog.print("was 1 warning"); mainLog.print("was 1 warning");

8
prism/src/prism/PrismLog.java

@ -362,6 +362,14 @@ public abstract class PrismLog
println(arr); println(arr);
} }
/**
* Prints a separator between sections of log output.
*/
public void printSeparator()
{
println("\n---------------------------------------------------------------------");
}
/** /**
* Prints a warning message {@code s}, preceded by "\nWarning: " and followed by a newline character. * Prints a warning message {@code s}, preceded by "\nWarning: " and followed by a newline character.
* <p/> * <p/>

1
prism/src/userinterface/GUIComputationThread.java

@ -72,6 +72,7 @@ public class GUIComputationThread extends Thread
public void logln(short s) { plug.logln(s); } public void logln(short s) { plug.logln(s); }
public void logln(byte b) { plug.logln(b); } public void logln(byte b) { plug.logln(b); }
public void logln(boolean b) { plug.logln(b); } public void logln(boolean b) { plug.logln(b); }
public void logSeparator() { plug.logSeparator(); }
public void logWarning(String s) { plug.logWarning(s); } public void logWarning(String s) { plug.logWarning(s); }
/** pop up an error dialog */ /** pop up an error dialog */

7
prism/src/userinterface/GUIPlugin.java

@ -543,6 +543,13 @@ public abstract class GUIPlugin extends JPanel implements GUIEventListener, Pris
gui.enableTab(this, enabled); gui.enableTab(this, enabled);
} }
/** Method to add a separator to the log contained within the parent GUIPrism.
*/
public void logSeparator()
{
notifyEventListeners(new GUILogEvent(GUILogEvent.PRINTSEPARATOR, ""));
}
/** Method to add a warning message to the log contained within the parent GUIPrism. /** Method to add a warning message to the log contained within the parent GUIPrism.
* @param message The message to be added to the log * @param message The message to be added to the log
*/ */

10
prism/src/userinterface/log/GUILog.java

@ -114,15 +114,19 @@ public class GUILog extends GUIPlugin implements MouseListener, PrismSettingsLis
if(e instanceof GUILogEvent) if(e instanceof GUILogEvent)
{ {
GUILogEvent le = (GUILogEvent)e; GUILogEvent le = (GUILogEvent)e;
if(le.getID() == le.PRINTLN)
if(le.getID() == GUILogEvent.PRINTLN)
{ {
theLog.println(le.getData()); theLog.println(le.getData());
} }
else if(le.getID() == le.PRINT)
else if(le.getID() == GUILogEvent.PRINT)
{ {
theLog.print(le.getData()); theLog.print(le.getData());
} }
else if(le.getID() == le.PRINTWARNING)
else if(le.getID() == GUILogEvent.PRINTSEPARATOR)
{
theLog.printSeparator();
}
else if(le.getID() == GUILogEvent.PRINTWARNING)
{ {
theLog.printWarning((String) le.getData()); theLog.printWarning((String) le.getData());
} }

2
prism/src/userinterface/model/computation/BuildModelThread.java

@ -190,7 +190,7 @@ public class BuildModelThread extends GUIComputationThread
// do build // do build
try { try {
logln("\n-------------------------------------------");
logSeparator();
model = prism.buildModel(mod); model = prism.buildModel(mod);
} }
catch (PrismException e) { catch (PrismException e) {

8
prism/src/userinterface/properties/GUIExperiment.java

@ -264,7 +264,7 @@ public class GUIExperiment
// build model // build model
try { try {
logln("\n-------------------------------------------");
logSeparator();
model = prism.buildModel(modulesFile); model = prism.buildModel(modulesFile);
clear = false; clear = false;
} catch (PrismException e) { } catch (PrismException e) {
@ -352,7 +352,7 @@ public class GUIExperiment
else if (useSimulation && prism.getSettings().getBoolean(PrismSettings.SIMULATOR_SIMULTANEOUS) else if (useSimulation && prism.getSettings().getBoolean(PrismSettings.SIMULATOR_SIMULTANEOUS)
&& undefinedConstants.getNumPropertyIterations() > 1) { && undefinedConstants.getNumPropertyIterations() > 1) {
try { try {
logln("\n-------------------------------------------");
logSeparator();
logln("\nSimulating: " + propertyToCheck); logln("\nSimulating: " + propertyToCheck);
if (definedMFConstants != null) if (definedMFConstants != null)
if (definedMFConstants.getNumValues() > 0) if (definedMFConstants.getNumValues() > 0)
@ -398,7 +398,7 @@ public class GUIExperiment
} }
// log output // log output
logln("\n-------------------------------------------");
logSeparator();
logln("\n" + (useSimulation ? "Simulating" : "Model checking") + ": " + propertyToCheck); logln("\n" + (useSimulation ? "Simulating" : "Model checking") + ": " + propertyToCheck);
if (definedMFConstants != null) if (definedMFConstants != null)
if (definedMFConstants.getNumValues() > 0) if (definedMFConstants.getNumValues() > 0)
@ -415,7 +415,7 @@ public class GUIExperiment
modulesFileToCheck = dc.getNewModulesFile(); modulesFileToCheck = dc.getNewModulesFile();
modulesFileToCheck.setUndefinedConstants(modulesFile.getConstantValues()); modulesFileToCheck.setUndefinedConstants(modulesFile.getConstantValues());
// build model // build model
logln("\n-------------------------------------------");
logSeparator();
model = prism.buildModel(modulesFileToCheck); model = prism.buildModel(modulesFileToCheck);
clear = false; clear = false;
// by construction, deadlocks can only occur from timelocks // by construction, deadlocks can only occur from timelocks

4
prism/src/userinterface/properties/computation/ModelCheckThread.java

@ -129,7 +129,7 @@ public class ModelCheckThread extends GUIComputationThread
// Do model checking // Do model checking
try { try {
// Print info to log // Print info to log
logln("\n-------------------------------------------");
logSeparator();
logln("\nModel checking: " + propertiesFile.getProperty(i)); logln("\nModel checking: " + propertiesFile.getProperty(i));
if (definedMFConstants != null) if (definedMFConstants != null)
if (definedMFConstants.getNumValues() > 0) if (definedMFConstants.getNumValues() > 0)
@ -145,7 +145,7 @@ public class ModelCheckThread extends GUIComputationThread
modulesFileToCheck = dc.getNewModulesFile(); modulesFileToCheck = dc.getNewModulesFile();
modulesFileToCheck.setUndefinedConstants(modulesFile.getConstantValues()); modulesFileToCheck.setUndefinedConstants(modulesFile.getConstantValues());
// build model // build model
logln("\n-------------------------------------------");
logSeparator();
model = prism.buildModel(modulesFileToCheck); model = prism.buildModel(modulesFileToCheck);
clear = false; clear = false;
// by construction, deadlocks can only occur from timelocks // by construction, deadlocks can only occur from timelocks

4
prism/src/userinterface/properties/computation/SimulateModelCheckThread.java

@ -114,7 +114,7 @@ public class SimulateModelCheckThread extends GUIComputationThread
try { try {
// display info // display info
logln("\n-------------------------------------------");
logSeparator();
log("\nSimulating"); log("\nSimulating");
if (pf.getNumProperties() == 1) { if (pf.getNumProperties() == 1) {
logln(": " + properties.get(0)); logln(": " + properties.get(0));
@ -179,7 +179,7 @@ public class SimulateModelCheckThread extends GUIComputationThread
ict.start(); ict.start();
// do model checking // do model checking
try { try {
logln("\n-------------------------------------------");
logSeparator();
logln("\nSimulating" + ": " + pf.getProperty(i)); logln("\nSimulating" + ": " + pf.getProperty(i));
if (definedMFConstants != null) if (definedMFConstants != null)
if (definedMFConstants.getNumValues() > 0) if (definedMFConstants.getNumValues() > 0)

3
prism/src/userinterface/util/GUILogEvent.java

@ -31,7 +31,8 @@ public class GUILogEvent extends GUIEvent
{ {
public static final int PRINTLN = 0; public static final int PRINTLN = 0;
public static final int PRINT = 1; public static final int PRINT = 1;
public static final int PRINTWARNING = 2;
public static final int PRINTSEPARATOR = 2;
public static final int PRINTWARNING = 3;
/** /**
* Constructs an instance of <code>GUILogEvent</code> with the specified detail message. * Constructs an instance of <code>GUILogEvent</code> with the specified detail message.

Loading…
Cancel
Save