Browse Source

ProbModelChecker.clear(): deref complete var arrays, fix StateModelChecker constructor

Before, if varNum did not match the array length, some varDDRowVars/varDDColVars
would not be dereferenced.

Now, deref all variables in the arrays if they are non-null.

In the StateModelChecker constructor for the dummy model, we can now
pass the correct number of variables and a copy of the varDDRowVars array.



git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@10447 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Joachim Klein 11 years ago
parent
commit
99e5420e4c
  1. 23
      prism/src/prism/ProbModel.java
  2. 4
      prism/src/prism/StateModelChecker.java

23
prism/src/prism/ProbModel.java

@ -870,18 +870,21 @@ public class ProbModel implements Model
return index;
}
// clear up (deref all dds, dd vars)
/**
* Clear the model (deref all DDs and DD variables)
*/
public void clear()
{
for (int i = 0; i < numVars; i++) {
varDDRowVars[i].derefAll();
varDDColVars[i].derefAll();
}
for (int i = 0; i < numModules; i++) {
moduleDDRowVars[i].derefAll();
moduleDDColVars[i].derefAll();
}
if (varDDRowVars != null)
JDDVars.derefAllArray(varDDRowVars);
if (varDDColVars != null)
JDDVars.derefAllArray(varDDColVars);
if (moduleDDRowVars != null)
JDDVars.derefAllArray(moduleDDRowVars);
if (moduleDDColVars != null)
JDDVars.derefAllArray(moduleDDColVars);
allDDRowVars.derefAll();
allDDColVars.derefAll();
JDD.Deref(trans);

4
prism/src/prism/StateModelChecker.java

@ -151,9 +151,9 @@ public class StateModelChecker implements ModelChecker
null, // moduleNames
null, // moduleRowVars
null, // moduleColVars
0, // numVars
varDDRowVars.length, // numVars
varList, // varList
varDDRowVars, // varDDRowVars
JDDVars.copyArray(varDDRowVars), // varDDRowVars
null, // varDDColVars
constantValues // constantValues
);

Loading…
Cancel
Save