Browse Source

Minor refactoring.

git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@11577 bbc10eb1-c90d-0410-af57-cb519fbb1720
master
Dave Parker 10 years ago
parent
commit
3ae531c33b
  1. 17
      prism/src/simulator/Updater.java

17
prism/src/simulator/Updater.java

@ -85,9 +85,6 @@ public class Updater extends PrismComponent
public Updater(ModulesFile modulesFile, VarList varList, PrismComponent parent) public Updater(ModulesFile modulesFile, VarList varList, PrismComponent parent)
{ {
int i, j;
String s;
// Store some settings // Store some settings
doProbChecks = parent.getSettings().getBoolean(PrismSettings.PRISM_DO_PROB_CHECKS); doProbChecks = parent.getSettings().getBoolean(PrismSettings.PRISM_DO_PROB_CHECKS);
sumRoundOff = parent.getSettings().getDouble(PrismSettings.PRISM_SUM_ROUND_OFF); sumRoundOff = parent.getSettings().getDouble(PrismSettings.PRISM_SUM_ROUND_OFF);
@ -104,15 +101,15 @@ public class Updater extends PrismComponent
// Compute count of number of modules using each synch action // Compute count of number of modules using each synch action
// First, compute and cache the synch actions for each of the modules // First, compute and cache the synch actions for each of the modules
List<HashSet<String>> synchsPerModule = new ArrayList<HashSet<String>>(numModules); List<HashSet<String>> synchsPerModule = new ArrayList<HashSet<String>>(numModules);
for (i = 0; i < numModules; i++) {
for (int i = 0; i < numModules; i++) {
synchsPerModule.add(new HashSet<String>(modulesFile.getModule(i).getAllSynchs())); synchsPerModule.add(new HashSet<String>(modulesFile.getModule(i).getAllSynchs()));
} }
// Second, do the counting // Second, do the counting
synchModuleCounts = new int[numSynchs]; synchModuleCounts = new int[numSynchs];
for (j = 0; j < numSynchs; j++) {
for (int j = 0; j < numSynchs; j++) {
synchModuleCounts[j] = 0; synchModuleCounts[j] = 0;
s = synchs.get(j);
for (i = 0; i < numModules; i++) {
String s = synchs.get(j);
for (int i = 0; i < numModules; i++) {
if (synchsPerModule.get(i).contains(s)) if (synchsPerModule.get(i).contains(s))
synchModuleCounts[j]++; synchModuleCounts[j]++;
} }
@ -120,15 +117,15 @@ public class Updater extends PrismComponent
// Build lists/bitsets for later use // Build lists/bitsets for later use
updateLists = new ArrayList<List<List<Updates>>>(numModules); updateLists = new ArrayList<List<List<Updates>>>(numModules);
for (i = 0; i < numModules; i++) {
for (int i = 0; i < numModules; i++) {
updateLists.add(new ArrayList<List<Updates>>(numSynchs + 1)); updateLists.add(new ArrayList<List<Updates>>(numSynchs + 1));
for (j = 0; j < numSynchs + 1; j++) {
for (int j = 0; j < numSynchs + 1; j++) {
updateLists.get(i).add(new ArrayList<Updates>()); updateLists.get(i).add(new ArrayList<Updates>());
} }
} }
enabledSynchs = new BitSet(numSynchs + 1); enabledSynchs = new BitSet(numSynchs + 1);
enabledModules = new BitSet[numSynchs + 1]; enabledModules = new BitSet[numSynchs + 1];
for (j = 0; j < numSynchs + 1; j++) {
for (int j = 0; j < numSynchs + 1; j++) {
enabledModules[j] = new BitSet(numModules); enabledModules[j] = new BitSet(numModules);
} }
} }

Loading…
Cancel
Save