Browse Source

Code tidy (GUI).

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@2007 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 16 years ago
parent
commit
fca4ce844e
  1. 784
      prism/src/userinterface/properties/GUIMultiProperties.java
  2. 241
      prism/src/userinterface/properties/GUIPropertiesList.java
  3. 167
      prism/src/userinterface/properties/GUIProperty.java
  4. 8
      prism/src/userinterface/properties/computation/ModelCheckThread.java

784
prism/src/userinterface/properties/GUIMultiProperties.java
File diff suppressed because it is too large
View File

241
prism/src/userinterface/properties/GUIPropertiesList.java

@ -81,7 +81,8 @@ public class GUIPropertiesList extends JList implements KeyListener
{ {
super.setFont(font); super.setFont(font);
// Note: minimum of 20 since icons are 16x16 // Note: minimum of 20 since icons are 16x16
if (font != null) setFixedCellHeight(Math.max(20, getFontMetrics(font).getHeight() + 4));
if (font != null)
setFixedCellHeight(Math.max(20, getFontMetrics(font).getHeight() + 4));
} }
//ACCESS METHODS //ACCESS METHODS
@ -91,87 +92,134 @@ public class GUIPropertiesList extends JList implements KeyListener
return listModel.size(); return listModel.size();
} }
public GUIProperty getProperty(int index)
/**
* Get the ith property in the list.
*/
public GUIProperty getProperty(int i)
{ {
return (GUIProperty)listModel.getElementAt(index);
return (GUIProperty) listModel.getElementAt(i);
} }
public int getNumValidProperties()
/**
* Check that all properties in the list are valid.
*/
public boolean allPropertiesAreValid()
{ {
int total = 0;
for(int i = 0; i < getNumProperties(); i++)
{
GUIProperty gp = getProperty(i);
if(gp.isValid()) total++;
for (int i = 0; i < getNumProperties(); i++) {
if (!getProperty(i).isValid())
return false;
} }
return total;
return true;
} }
/**
* Get the number of properties currently selected in the list.
*/
public int getNumSelectedProperties() public int getNumSelectedProperties()
{ {
return getSelectedIndices().length; return getSelectedIndices().length;
} }
public ArrayList getSelectedProperties()
/**
* Get a list of the properties currently selected in the list.
*/
public ArrayList<GUIProperty> getSelectedProperties()
{ {
ArrayList<GUIProperty> gps = new ArrayList<GUIProperty>();
int[] ind = getSelectedIndices(); int[] ind = getSelectedIndices();
ArrayList ps = new ArrayList();
for(int i = 0; i < ind.length; i++)
ps.add(getProperty(ind[i]));
return ps;
for (int i = 0; i < ind.length; i++) {
gps.add(getProperty(ind[i]));
}
return gps;
} }
public ArrayList getValidSelectedProperties()
/**
* Check if there are any valid properties currently selected in the list.
*/
public boolean existsValidSelectedProperties()
{ {
ArrayList gps = new ArrayList();
ArrayList prs = getSelectedProperties();
for(int i = 0; i < prs.size(); i++)
{
GUIProperty gp = (GUIProperty)prs.get(i);
if(gp.isValid())
{
gps.add(gp);
if (parent.getParsedModel() == null)
return false;
int[] ind = getSelectedIndices();
for (int i = 0; i < ind.length; i++) {
if (getProperty(ind[i]).isValid()) {
return true;
} }
} }
return gps;
return false;
} }
public ArrayList getValidSimulatableSelectedProperties()
/**
* Get a list of the valid properties currently selected in the list.
*/
public ArrayList<GUIProperty> getValidSelectedProperties()
{ {
ArrayList gps = new ArrayList();
if(parent.getParsedModel() == null) return gps;
ArrayList prs = getSelectedProperties();
for(int i = 0; i < prs.size(); i++)
{
GUIProperty gp = (GUIProperty)prs.get(i);
if(gp.isValidForSimulation())
{
ArrayList<GUIProperty> gps = new ArrayList<GUIProperty>();
if (parent.getParsedModel() == null)
return gps;
int[] ind = getSelectedIndices();
for (int i = 0; i < ind.length; i++) {
GUIProperty gp = getProperty(ind[i]);
if (gp.isValid()) {
gps.add(gp); gps.add(gp);
} }
} }
return gps; return gps;
} }
/**
* Get a string comprising concatenation of all valid properties currently selected in the list.
*/
public String getValidSelectedString() public String getValidSelectedString()
{ {
String str = ""; String str = "";
ArrayList prs = getValidSelectedProperties();
for(int i = 0; i < prs.size(); i++)
{
str += ((GUIProperty)prs.get(i)).getPropString()+"\n";
ArrayList<GUIProperty> gps = getValidSelectedProperties();
for (GUIProperty gp : gps) {
str += gp.getPropString() + "\n";
} }
return str; return str;
} }
/**
* Check if there are any valid and simulate-able properties currently selected in the list.
*/
public boolean existsValidSimulatableSelectedProperties()
{
if (parent.getParsedModel() == null)
return false;
int[] ind = getSelectedIndices();
for (int i = 0; i < ind.length; i++) {
if (getProperty(ind[i]).isValidForSimulation()) {
return true;
}
}
return false;
}
/**
* Get a list of the valid and simulate-able properties currently selected in the list.
*/
public ArrayList<GUIProperty> getValidSimulatableSelectedProperties()
{
ArrayList<GUIProperty> gps = new ArrayList<GUIProperty>();
if (parent.getParsedModel() == null)
return gps;
int[] ind = getSelectedIndices();
for (int i = 0; i < ind.length; i++) {
GUIProperty gp = getProperty(ind[i]);
if (gp.isValidForSimulation()) {
gps.add(gp);
}
}
return gps;
}
public int getIndexOf(String id) public int getIndexOf(String id)
{ {
int index = -1; int index = -1;
for(int i = 0; i < getNumProperties(); i++)
{
for (int i = 0; i < getNumProperties(); i++) {
String str = getProperty(i).getID(); String str = getProperty(i).getID();
if(id.equals(str))
{
if (id.equals(str)) {
index = i; index = i;
break; break;
} }
@ -182,13 +230,13 @@ public class GUIPropertiesList extends JList implements KeyListener
//Used for cut and copy //Used for cut and copy
public String getClipboardString() public String getClipboardString()
{ {
int[]ind = getSelectedIndices();
int[] ind = getSelectedIndices();
String str = ""; String str = "";
for(int i = 0 ; i < ind.length; i++)
{
for (int i = 0; i < ind.length; i++) {
GUIProperty gp = getProperty(i); GUIProperty gp = getProperty(i);
str+=gp.getPropString();
if(i != ind.length-1) str+="\n";
str += gp.getPropString();
if (i != ind.length - 1)
str += "\n";
} }
return str; return str;
} }
@ -198,16 +246,15 @@ public class GUIPropertiesList extends JList implements KeyListener
public void addProperty(String propString, String comment) public void addProperty(String propString, String comment)
{ {
counter++; counter++;
GUIProperty gp = new GUIProperty(prism, "PROPERTY"+counter, propString, comment);
GUIProperty gp = new GUIProperty(prism, "PROPERTY" + counter, propString, comment);
gp.parse(parent.getParsedModel(), parent.getConstantsString(), parent.getLabelsString()); gp.parse(parent.getParsedModel(), parent.getConstantsString(), parent.getLabelsString());
listModel.addElement(gp); listModel.addElement(gp);
} }
public void setProperty(int index, String propString, String comment) public void setProperty(int index, String propString, String comment)
{ {
counter++; counter++;
GUIProperty gp = new GUIProperty(prism, "PROPERTY"+counter, propString, comment);
GUIProperty gp = new GUIProperty(prism, "PROPERTY" + counter, propString, comment);
gp.parse(parent.getParsedModel(), parent.getConstantsString(), parent.getLabelsString()); gp.parse(parent.getParsedModel(), parent.getConstantsString(), parent.getLabelsString());
listModel.setElementAt(gp, index); listModel.setElementAt(gp, index);
} }
@ -216,8 +263,7 @@ public class GUIPropertiesList extends JList implements KeyListener
public void pastePropertiesString(String str) public void pastePropertiesString(String str)
{ {
StringTokenizer sto = new StringTokenizer(str, "\n"); StringTokenizer sto = new StringTokenizer(str, "\n");
while(sto.hasMoreTokens())
{
while (sto.hasMoreTokens()) {
String token = sto.nextToken(); String token = sto.nextToken();
// Make sure it isn't comment we are pasting // Make sure it isn't comment we are pasting
@ -228,8 +274,7 @@ public class GUIPropertiesList extends JList implements KeyListener
public void addPropertiesFile(PropertiesFile pf) public void addPropertiesFile(PropertiesFile pf)
{ {
for(int i = 0; i < pf.getNumProperties(); i++)
{
for (int i = 0; i < pf.getNumProperties(); i++) {
String str = pf.getProperty(i).toString(); String str = pf.getProperty(i).toString();
String com = pf.getPropertyComment(i); String com = pf.getPropertyComment(i);
addProperty(str, com); addProperty(str, com);
@ -239,29 +284,24 @@ public class GUIPropertiesList extends JList implements KeyListener
public boolean deleteProperty(int index) public boolean deleteProperty(int index)
{ {
GUIProperty gp = getProperty(index); GUIProperty gp = getProperty(index);
if(!gp.isBeingEdited())
{
if (!gp.isBeingEdited()) {
listModel.removeElementAt(index); listModel.removeElementAt(index);
return true; return true;
}
else return false;
} else
return false;
} }
public void deleteSelected() public void deleteSelected()
{ {
while(!isSelectionEmpty())
{
while (!isSelectionEmpty()) {
boolean deleted = deleteProperty(getSelectedIndex()); boolean deleted = deleteProperty(getSelectedIndex());
if(!deleted)
{
if (!deleted) {
//if not deleted, unselect, so the rest can!! //if not deleted, unselect, so the rest can!!
int[]ind = getSelectedIndices();
int[]newInd = new int[ind.length-1];
int[] ind = getSelectedIndices();
int[] newInd = new int[ind.length - 1];
int c = 0; int c = 0;
for(int i = 0; i < ind.length; i++)
{
if(ind[i] != getSelectedIndex())
{
for (int i = 0; i < ind.length; i++) {
if (ind[i] != getSelectedIndex()) {
newInd[c] = ind[i]; newInd[c] = ind[i];
c++; c++;
} }
@ -279,9 +319,8 @@ public class GUIPropertiesList extends JList implements KeyListener
public void selectAll() public void selectAll()
{ {
if(getNumProperties() > 0)
{
setSelectionInterval(0, getNumProperties()-1);
if (getNumProperties() > 0) {
setSelectionInterval(0, getNumProperties() - 1);
} }
} }
@ -290,8 +329,7 @@ public class GUIPropertiesList extends JList implements KeyListener
public void validateProperties() public void validateProperties()
{ {
for(int i = 0; i < getNumProperties(); i++)
{
for (int i = 0; i < getNumProperties(); i++) {
GUIProperty p = getProperty(i); GUIProperty p = getProperty(i);
p.parse(parent.getParsedModel(), parent.getConstantsString(), parent.getLabelsString()); p.parse(parent.getParsedModel(), parent.getConstantsString(), parent.getLabelsString());
} }
@ -304,8 +342,8 @@ public class GUIPropertiesList extends JList implements KeyListener
public String toFileString(File f, GUIPropConstantList consList, GUIPropLabelList labList) public String toFileString(File f, GUIPropConstantList consList, GUIPropLabelList labList)
{ {
int numProp; int numProp;
String s, s2[];
int i, j;
String s;
int i;
s = ""; s = "";
if (consList.getNumConstants() > 0) { if (consList.getNumConstants() > 0) {
@ -315,10 +353,9 @@ public class GUIPropertiesList extends JList implements KeyListener
s += labList.getLabelsString() + "\n"; s += labList.getLabelsString() + "\n";
} }
numProp = getNumProperties(); numProp = getNumProperties();
for(i = 0; i < numProp; i++)
{
for (i = 0; i < numProp; i++) {
GUIProperty gp = getProperty(i); GUIProperty gp = getProperty(i);
if (gp.getComment().length()>0)
if (gp.getComment().length() > 0)
s += PrismParser.slashCommentBlock(gp.getComment()); s += PrismParser.slashCommentBlock(gp.getComment());
s += gp.getPropString() + "\n\n"; s += gp.getPropString() + "\n\n";
} }
@ -330,31 +367,20 @@ public class GUIPropertiesList extends JList implements KeyListener
public void keyPressed(KeyEvent e) public void keyPressed(KeyEvent e)
{ {
if(e.getModifiers() == KeyEvent.CTRL_MASK)
{
if(e.getKeyCode() == KeyEvent.VK_C)
{
if (e.getModifiers() == KeyEvent.CTRL_MASK) {
if (e.getKeyCode() == KeyEvent.VK_C) {
parent.a_copy(); parent.a_copy();
}
else if(e.getKeyCode() == KeyEvent.VK_V)
{
} else if (e.getKeyCode() == KeyEvent.VK_V) {
parent.a_paste(); parent.a_paste();
}
else if(e.getKeyCode() == KeyEvent.VK_X)
{
} else if (e.getKeyCode() == KeyEvent.VK_X) {
parent.a_cut(); parent.a_cut();
}
else if(e.getKeyCode() == KeyEvent.VK_D)
{
} else if (e.getKeyCode() == KeyEvent.VK_D) {
parent.a_delete(); parent.a_delete();
}
else if(e.getKeyCode() == KeyEvent.VK_A)
{
} else if (e.getKeyCode() == KeyEvent.VK_A) {
parent.a_selectAll(); parent.a_selectAll();
} }
} }
if(e.getKeyCode() == KeyEvent.VK_DELETE)
{
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
parent.a_delete(); parent.a_delete();
} }
} }
@ -399,27 +425,20 @@ public class GUIPropertiesList extends JList implements KeyListener
setIcon(p.getImage()); setIcon(p.getImage());
// foreground/background colours // foreground/background colours
if(isSelected)
{
if (isSelected) {
setBackground(parent.getSelectionColor()); setBackground(parent.getSelectionColor());
setForeground(p.isValid() ? Color.black : Color.red); setForeground(p.isValid() ? Color.black : Color.red);
}
else
{
if(!p.isValid())
{
} else {
if (!p.isValid()) {
setBackground(parent.getWarningColor()); setBackground(parent.getWarningColor());
setForeground(Color.red); setForeground(Color.red);
}
else
{
} else {
setBackground(Color.white); setBackground(Color.white);
setForeground(Color.black); setForeground(Color.black);
} }
} }
if(p.isBeingEdited())
{
if (p.isBeingEdited()) {
setBackground(Color.lightGray); setBackground(Color.lightGray);
} }
@ -431,7 +450,7 @@ public class GUIPropertiesList extends JList implements KeyListener
{ {
public Insets getBorderInsets(Component c) public Insets getBorderInsets(Component c)
{ {
return new Insets(0,0,0,0);
return new Insets(0, 0, 0, 0);
} }
public boolean isBorderOpaque() public boolean isBorderOpaque()
@ -442,7 +461,7 @@ public class GUIPropertiesList extends JList implements KeyListener
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
{ {
g.setColor(Color.lightGray); g.setColor(Color.lightGray);
g.drawLine(x,(y+height-1), (x+width), (y+height-1));
g.drawLine(x, (y + height - 1), (x + width), (y + height - 1));
} }
} }

167
prism/src/userinterface/properties/GUIProperty.java

@ -27,15 +27,16 @@
//============================================================================== //==============================================================================
package userinterface.properties; package userinterface.properties;
import javax.swing.*;
import userinterface.GUIPrism; import userinterface.GUIPrism;
import parser.*; import parser.*;
import parser.ast.*; import parser.ast.*;
import prism.*; import prism.*;
import javax.swing.*;
/** /**
*
* @author ug60axh
* Encapsulates a property in the list in the GUI "Properties" tab.
*/ */
public class GUIProperty public class GUIProperty
{ {
@ -71,25 +72,24 @@ public class GUIProperty
/** Property status */ /** Property status */
public static final int STATUS_RESULT_NUMBER = 6; public static final int STATUS_RESULT_NUMBER = 6;
//ATTRIBUTES //ATTRIBUTES
private Prism prism; // Required for parsing
private Prism prism; // Required for parsing
private String id; // Unique ID
private int status; // Status - see constants above
private ImageIcon doingImage; // Image when in DOING state - can be modified externally for animations
private boolean beingEdited; // Is this property currently being edited?
private String id; // Unique ID
private int status; // Status - see constants above
private ImageIcon doingImage; // Image when in DOING state - can be modified externally for animations
private boolean beingEdited; // Is this property currently being edited?
private String propString; // String representing the property
private Expression expr; // The parsed property
private String comment; // The property's comment
private String propString; // String representing the property
private Expression expr; // The parsed property (null if invalid)
private String comment; // The property's comment
private Result result; // Result of model checking etc. (if done, null if not)
private String parseError; // Parse error (if property is invalid)
private Result result; // Result of model checking etc. (if done, null if not)
private String parseError; // Parse error (if property is invalid)
private String method; // Method used (verification, simulation)
private String constantsString; // Constant values used
private String method; // Method used (verification, simulation)
private String constantsString; // Constant values used
/** Creates a new instance of GUIProperty */ /** Creates a new instance of GUIProperty */
public GUIProperty(Prism prism, String id, String propString, String comment) public GUIProperty(Prism prism, String id, String propString, String comment)
@ -126,14 +126,22 @@ public class GUIProperty
public ImageIcon getImage() public ImageIcon getImage()
{ {
switch (status) { switch (status) {
case STATUS_NOT_DONE: return IMAGE_NOT_DONE;
case STATUS_DOING: return doingImage;
case STATUS_PARSE_ERROR: return IMAGE_INVALID;
case STATUS_RESULT_ERROR: return IMAGE_ERROR;
case STATUS_RESULT_TRUE: return IMAGE_TICK;
case STATUS_RESULT_FALSE: return IMAGE_CROSS;
case STATUS_RESULT_NUMBER: return IMAGE_NUMBER;
default: return IMAGE_NOT_DONE;
case STATUS_NOT_DONE:
return IMAGE_NOT_DONE;
case STATUS_DOING:
return doingImage;
case STATUS_PARSE_ERROR:
return IMAGE_INVALID;
case STATUS_RESULT_ERROR:
return IMAGE_ERROR;
case STATUS_RESULT_TRUE:
return IMAGE_TICK;
case STATUS_RESULT_FALSE:
return IMAGE_CROSS;
case STATUS_RESULT_NUMBER:
return IMAGE_NUMBER;
default:
return IMAGE_NOT_DONE;
} }
} }
@ -157,6 +165,9 @@ public class GUIProperty
return comment; return comment;
} }
/**
* Is this property valid? i.e. Did it parse OK last time it was parsed?
*/
public boolean isValid() public boolean isValid()
{ {
return expr != null; return expr != null;
@ -164,28 +175,26 @@ public class GUIProperty
// just a basic check - see if it's a P=? or R=? property // just a basic check - see if it's a P=? or R=? property
/**
* Is this property both valid (i.e. parsed OK last time it was checked)
* and suitable approximate verification through simulation?
*/
public boolean isValidForSimulation() public boolean isValidForSimulation()
{ {
boolean b = isValid() && (expr instanceof ExpressionProb || expr instanceof ExpressionReward); boolean b = isValid() && (expr instanceof ExpressionProb || expr instanceof ExpressionReward);
if(b)
{
if(expr instanceof ExpressionProb)
{
if ((((ExpressionProb)expr).getProb() != null))
{
if (b) {
if (expr instanceof ExpressionProb) {
if ((((ExpressionProb) expr).getProb() != null)) {
return false; return false;
} }
}
else if(expr instanceof ExpressionReward)
{
if ((((ExpressionReward)expr).getReward() != null))
{
} else if (expr instanceof ExpressionReward) {
if ((((ExpressionReward) expr).getReward() != null)) {
return false; return false;
} }
} }
return true; return true;
}
else return false;
} else
return false;
} }
public Result getResult() public Result getResult()
@ -201,10 +210,14 @@ public class GUIProperty
public String getToolTipText() public String getToolTipText()
{ {
switch (status) { switch (status) {
case STATUS_DOING: return "In progress...";
case STATUS_PARSE_ERROR: return "Invalid property: " + parseError;
case STATUS_RESULT_ERROR: return getResultString();
default: return "Result: " + getResultString();
case STATUS_DOING:
return "In progress...";
case STATUS_PARSE_ERROR:
return "Invalid property: " + parseError;
case STATUS_RESULT_ERROR:
return getResultString();
default:
return "Result: " + getResultString();
} }
} }
@ -255,24 +268,17 @@ public class GUIProperty
public void setResult(Result res) public void setResult(Result res)
{ {
result = res; result = res;
if (result.getResult() instanceof Boolean)
{
if (((Boolean)result.getResult()).booleanValue()) {
if (result.getResult() instanceof Boolean) {
if (((Boolean) result.getResult()).booleanValue()) {
setStatus(STATUS_RESULT_TRUE); setStatus(STATUS_RESULT_TRUE);
} else { } else {
setStatus(STATUS_RESULT_FALSE); setStatus(STATUS_RESULT_FALSE);
} }
}
else if (result.getResult() instanceof Double)
{
} else if (result.getResult() instanceof Double) {
setStatus(STATUS_RESULT_NUMBER); setStatus(STATUS_RESULT_NUMBER);
}
else if (result.getResult() instanceof Exception)
{
} else if (result.getResult() instanceof Exception) {
setStatus(STATUS_RESULT_ERROR); setStatus(STATUS_RESULT_ERROR);
}
else
{
} else {
setStatus(STATUS_NOT_DONE); setStatus(STATUS_NOT_DONE);
result = null; result = null;
} }
@ -289,65 +295,60 @@ public class GUIProperty
constantsString = mfConstants.toString(); constantsString = mfConstants.toString();
if (pfConstants != null && pfConstants.getNumValues() > 0) if (pfConstants != null && pfConstants.getNumValues() > 0)
constantsString += ", " + pfConstants.toString(); constantsString += ", " + pfConstants.toString();
}
else if (pfConstants != null && pfConstants.getNumValues() > 0) {
} else if (pfConstants != null && pfConstants.getNumValues() > 0) {
constantsString = pfConstants.toString(); constantsString = pfConstants.toString();
}
else {
} else {
constantsString = "<none>"; constantsString = "<none>";
} }
} }
public void parse(ModulesFile m, String constantsString, String labelString) public void parse(ModulesFile m, String constantsString, String labelString)
{ {
if(propString == null || constantsString == null || labelString == null)
{
if (propString == null || constantsString == null || labelString == null) {
expr = null; expr = null;
setStatus(STATUS_PARSE_ERROR); setStatus(STATUS_PARSE_ERROR);
parseError = "(Unexpected) Properties, constants or labels are null"; parseError = "(Unexpected) Properties, constants or labels are null";
return; return;
} }
try
{
try {
//Parse constants and labels //Parse constants and labels
boolean couldBeNoConstantsOrLabels = false; boolean couldBeNoConstantsOrLabels = false;
PropertiesFile fConLab = null; PropertiesFile fConLab = null;
try
{
fConLab = prism.parsePropertiesString(m, constantsString+"\n"+labelString);
}
catch(PrismException e)
{
try {
fConLab = prism.parsePropertiesString(m, constantsString + "\n" + labelString);
} catch (PrismException e) {
couldBeNoConstantsOrLabels = true; couldBeNoConstantsOrLabels = true;
} }
//Parse all together //Parse all together
String withConsLabs = constantsString+"\n"+labelString+"\n"+propString;
String withConsLabs = constantsString + "\n" + labelString + "\n" + propString;
PropertiesFile ff = prism.parsePropertiesString(m, withConsLabs); PropertiesFile ff = prism.parsePropertiesString(m, withConsLabs);
//Validation of number of properties //Validation of number of properties
if(ff.getNumProperties() == 0) throw new PrismException("Empty Property");
else if(ff.getNumProperties() > 1) throw new PrismException("Contains Multiple Properties");
if (ff.getNumProperties() == 0)
throw new PrismException("Empty Property");
else if (ff.getNumProperties() > 1)
throw new PrismException("Contains Multiple Properties");
//Validation of constants and labels //Validation of constants and labels
if(!couldBeNoConstantsOrLabels)
{
if(ff.getConstantList().size() != fConLab.getConstantList().size()) throw new PrismException("Contains constants");
if(ff.getLabelList().size() != fConLab.getLabelList().size()) throw new PrismException("Contains labels");
}
else
{
if(ff.getConstantList().size() != 0) throw new PrismException("Contains constants");
if(ff.getLabelList().size() != 0) throw new PrismException("Contains labels");
if (!couldBeNoConstantsOrLabels) {
if (ff.getConstantList().size() != fConLab.getConstantList().size())
throw new PrismException("Contains constants");
if (ff.getLabelList().size() != fConLab.getLabelList().size())
throw new PrismException("Contains labels");
} else {
if (ff.getConstantList().size() != 0)
throw new PrismException("Contains constants");
if (ff.getLabelList().size() != 0)
throw new PrismException("Contains labels");
} }
//Now set the property //Now set the property
expr = ff.getProperty(0); expr = ff.getProperty(0);
parseError = "(Unexpected) no error!"; parseError = "(Unexpected) no error!";
// if status was previously a parse error, reset status. // if status was previously a parse error, reset status.
// otherwise, don't set status - reparse doesn't mean existing results should be lost // otherwise, don't set status - reparse doesn't mean existing results should be lost
if (getStatus() == STATUS_PARSE_ERROR) setStatus(STATUS_NOT_DONE);
}
catch(PrismException ex)
{
if (getStatus() == STATUS_PARSE_ERROR)
setStatus(STATUS_NOT_DONE);
} catch (PrismException ex) {
expr = null; expr = null;
setStatus(STATUS_PARSE_ERROR); setStatus(STATUS_PARSE_ERROR);
parseError = ex.getMessage(); parseError = ex.getMessage();

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

@ -46,12 +46,12 @@ public class ModelCheckThread extends GUIComputationThread
private GUIMultiProperties parent; private GUIMultiProperties parent;
private Model m; private Model m;
private PropertiesFile prFi; private PropertiesFile prFi;
private ArrayList guiProps;
private ArrayList<GUIProperty> guiProps;
private Values definedMFConstants; private Values definedMFConstants;
private Values definedPFConstants; private Values definedPFConstants;
/** Creates a new instance of ModelCheckThread */ /** Creates a new instance of ModelCheckThread */
public ModelCheckThread(GUIMultiProperties parent, Model m, PropertiesFile prFi, ArrayList guiProps, Values definedMFConstants, Values definedPFConstants)
public ModelCheckThread(GUIMultiProperties parent, Model m, PropertiesFile prFi, ArrayList<GUIProperty> guiProps, Values definedMFConstants, Values definedPFConstants)
{ {
super(parent); super(parent);
this.parent = parent; this.parent = parent;
@ -82,7 +82,7 @@ public class ModelCheckThread extends GUIComputationThread
//Set icon for all properties to be verified to a clock //Set icon for all properties to be verified to a clock
for(int i = 0; i < guiProps.size(); i++) for(int i = 0; i < guiProps.size(); i++)
{ {
GUIProperty gp = (GUIProperty)guiProps.get(i);
GUIProperty gp = guiProps.get(i);
gp.setStatus(GUIProperty.STATUS_DOING); gp.setStatus(GUIProperty.STATUS_DOING);
parent.repaintList(); parent.repaintList();
} }
@ -92,7 +92,7 @@ public class ModelCheckThread extends GUIComputationThread
for(int i = 0; i < prFi.getNumProperties(); i++) for(int i = 0; i < prFi.getNumProperties(); i++)
{ {
// get property // get property
GUIProperty gp = (GUIProperty)guiProps.get(i);
GUIProperty gp = guiProps.get(i);
// animate it's clock icon // animate it's clock icon
ic = new IconThread(gp); ic = new IconThread(gp);
ic.start(); ic.start();

Loading…
Cancel
Save