// Initialize with necessary information from the CG
if (nextCG instanceof IntChoiceFromSet) {
IntChoiceFromSet icsCG = (IntChoiceFromSet) nextCG;
+ // Tell JPF that we are performing DPOR
+ icsCG.setDpor();
if (!isEndOfExecution) {
// Check if CG has been initialized, otherwise initialize it
Integer[] cgChoices = icsCG.getAllChoices();
// int values to choose from stored as Strings or Integers
protected T[] values;
protected int count = -1;
+
+ // TODO: Fix for Groovy's model-checking
+ // TODO: This is a setter to change the values of the ChoiceGenerator to implement POR
+ protected boolean isDpor = false;
/**
* super constructor for subclasses that want to configure themselves
super(id);
values = vals;
count = -1;
+ isDpor = false;
}
protected abstract T[] createValueArray(int len);
public boolean hasMoreChoices() {
// TODO: Fix for Groovy's model-checking
// TODO: This is a setter to change the values of the ChoiceGenerator to implement POR
- if (!isDone)
- return true;
- else
- return false;
-
- /* TODO: ORIGINAL CODE
- if (!isDone && (count < values.length-1))
- return true;
- else
- return false;*/
+ if (isDpor) {
+ if (!isDone)
+ return true;
+ else
+ return false;
+ } else {
+ /* TODO: ORIGINAL CODE*/
+ if (!isDone && (count < values.length - 1))
+ return true;
+ else
+ return false;
+ }
}
/**
// TODO: This is a setter to change the values of the ChoiceGenerator to implement POR
// TODO: We make this circular
- if (count < values.length-1) count++;
- else count = 0;
-
- /* TODO: ORIGINAL CODE
- if (count < values.length-1) count++;*/
+ if (isDpor) {
+ if (count < values.length - 1) count++;
+ else count = 0;
+ } else {
+ /* TODO: ORIGINAL CODE*/
+ if (count < values.length - 1) count++;
+ }
}
/**
throw new JPFException("illegal value " + idx + " for array index");
}
}
+
+ public void setDpor() {
+ isDpor = true;
+ }
}