Browse Source

Property: handle missing constant in search for right // RESULT line

constValues.getValueOf() throws an Exception if the constant value
does not exist. This may happen, e.g., for parametric model checking,
where the parametric constants will have no values.

So, we first check if the constant value exists. If this is not the
case then the RESULT line is clearly no match.

In the future, it might make sense to handle parametric constants
differently than non-existent constants, e.g., to provide a warning
for a nonsensical RESULT line in the latter case.


git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11601 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 9 years ago
parent
commit
ba6c74270f
  1. 10
      prism/src/parser/ast/Property.java

10
prism/src/parser/ast/Property.java

@ -176,7 +176,14 @@ public class Property extends ASTElement
// Make sure constant/value is in constValues list and matches
String constName = pair[0].trim();
String constVal = pair[1].trim();
Object constValToMatch = constValues.getValueOf(constName);
Object constValToMatch;
if (constValues.getIndexOf(constName) == -1) {
// there is no constant of that name, might be a parametric constant
constValToMatch = null;
} else {
constValToMatch = constValues.getValueOf(constName);
}
if (constValToMatch == null)
match = false;
// Check doubles numerically
@ -185,6 +192,7 @@ public class Property extends ASTElement
// Otherwise just check for exact string match for now
else
match = constValToMatch.toString().equals(constVal);
// We need all constants to match
allMatch &= match;
}

Loading…
Cancel
Save