- private int getCurrentChoice(VM vm) {
- ChoiceGenerator<?> currentCG = vm.getChoiceGenerator();
- // This is the main event CG
- if (currentCG instanceof IntChoiceFromSet) {
- return ((IntChoiceFromSet) currentCG).getNextChoiceIndex();
- } else {
- // This is the interval CG used in device handlers
- ChoiceGenerator<?> parentCG = ((IntIntervalGenerator) currentCG).getPreviousChoiceGenerator();
- return ((IntChoiceFromSet) parentCG).getNextChoiceIndex();
- }
- }
-
- private int getHighestStateId(IntChoiceFromSet icsCG, VM vm) {
- // Try to look for the highest state from the queue
- int hiStateId = backtrackStateQ.peek();
- // Check with the current state and if it's lower than the highest state, we defer to this lower state
- int currStateId = icsCG.getStateId();
- if (currStateId < hiStateId) {
- // Find the next CG with the next highest state
- while (!cgMap.keySet().contains(currStateId) && currStateId > 0) { // Stop at state 0
- currStateId--;
- }
- if (currStateId > 0) { // If we reach this, it means that there are only CGs with higher states left
- hiStateId = currStateId;
- }
- }
-
- return hiStateId;
- }
-