Browse Source

param.StateEliminator: provide variant of collectStatesBackward() that only returns the reachable predecessors

master
Joachim Klein 8 years ago
committed by Dave Parker
parent
commit
189275bed4
  1. 19
      prism/src/param/StateEliminator.java

19
prism/src/param/StateEliminator.java

@ -124,10 +124,23 @@ final class StateEliminator {
* Orders states so that states near target states are eliminated first.
* States which do not reach target states are eliminated last. In case
* there are no target states, the order is arbitrary
*/
private int[] collectStatesBackward()
{
return collectStatesBackward(false);
}
/**
* Orders states so that states near target states are eliminated first.
* States which do not reach target states are eliminated last. In case
* there are no target states, the order is arbitrary
* <br>
* If {@code onlyStatesReachingTarget} is true, only the states that
* can reach the target states will be returned.
*
* @return list of states in requested order
*/
private int[] collectStatesBackward()
private int[] collectStatesBackward(boolean onlyStatesReachingTarget)
{
int[] states = new int[pmc.getNumStates()];
BitSet seen = new BitSet(pmc.getNumStates());
@ -156,6 +169,10 @@ final class StateEliminator {
current = next;
}
if (onlyStatesReachingTarget) {
return states;
}
/* might not find all states when doing as above,
* so add missing ones */
HashSet<Integer> allStates = new HashSet<Integer>();

Loading…
Cancel
Save