+ private void checkAndEnforceFairScheduling(IntChoiceFromSet icsCG) {
+ // Check the next choice and if the value is not the same as the expected then force the expected value
+ int choiceIndex = (choiceCounter - 1) % refChoices.length;
+ if (choices[choiceIndex] != icsCG.getNextChoiceIndex()) {
+ int expectedChoice = refChoices[choiceIndex];
+ int currCGIndex = icsCG.getNextChoiceIndex();
+ if ((currCGIndex >= 0) && (currCGIndex < refChoices.length)) {
+ icsCG.setChoice(currCGIndex, expectedChoice);
+ }
+ }
+ }
+
+ private boolean terminateCurrentExecution() {
+ // We need to check all the states that have just been visited
+ // Often a transition (choice/event) can result into forwarding/backtracking to a number of states
+ for(Integer stateId : justVisitedStates) {
+ if (prevVisitedStates.contains(stateId) || containsCyclesWithAllEvents(stateId)) {
+ return true;
+ }
+ }
+ return false;
+ }
+