From 38785c8356925d23a003418667975ae60c99ed93 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Mon, 15 Jul 2019 20:59:30 +0100 Subject: [PATCH] Add getUndefinedConstantValues() to PropertiesFile (like in ModulesFile). --- prism/src/parser/ast/PropertiesFile.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/prism/src/parser/ast/PropertiesFile.java b/prism/src/parser/ast/PropertiesFile.java index 5d0a46d1..bac31faa 100644 --- a/prism/src/parser/ast/PropertiesFile.java +++ b/prism/src/parser/ast/PropertiesFile.java @@ -52,7 +52,9 @@ public class PropertiesFile extends ASTElement // list of all identifiers used private Vector allIdentsUsed; - // actual values of (some or all) constants + // Values set for undefined constants (null if none) + private Values undefinedConstantValues; + // Actual values of (some or all) constants private Values constantValues; // Constructor @@ -66,6 +68,7 @@ public class PropertiesFile extends ASTElement constantList = new ConstantList(); properties = new Vector(); allIdentsUsed = new Vector(); + undefinedConstantValues = null; constantValues = null; } @@ -555,6 +558,7 @@ public class PropertiesFile extends ASTElement */ public void setUndefinedConstants(Values someValues, boolean exact) throws PrismLangException { + undefinedConstantValues = someValues == null ? null : new Values(someValues); // Might need values for ModulesFile constants too constantValues = constantList.evaluateConstants(someValues, modulesFile.getConstantValues(), exact); // Note: unlike ModulesFile, we don't trigger any semantic checks at this point @@ -585,6 +589,7 @@ public class PropertiesFile extends ASTElement */ public void setSomeUndefinedConstants(Values someValues, boolean exact) throws PrismLangException { + undefinedConstantValues = someValues == null ? null : new Values(someValues); // Might need values for ModulesFile constants too constantValues = constantList.evaluateSomeConstants(someValues, modulesFile.getConstantValues(), exact); // Note: unlike ModulesFile, we don't trigger any semantic checks at this point @@ -600,6 +605,15 @@ public class PropertiesFile extends ASTElement return constantList.isDefinedConstant(name); } + /** + * Get access to the values that have been provided for undefined constants in the model + * (e.g. via the method {@link #setUndefinedConstants(Values)}). + */ + public Values getUndefinedConstantValues() + { + return undefinedConstantValues; + } + /** * Get access to the values for all constants in the properties file, including the * undefined constants set previously via the method {@link #setUndefinedConstants(Values)}