}
List<GdlConstant> tuple = tuples.get(curIndex);
List<Integer> varsChosen = plan.getVarsChosenBySource().get(s);
List<Boolean> putDontCheckTuple = plan.getPutDontCheckBySource().get(s);
for(int i = 0; i < tuple.size(); i++) {
GdlConstant value = tuple.get(i);
boolean putDontCheck = putDontCheckTuple.get(i);
int varSlotChosen = varsChosen.get(i);
if(putDontCheck) {
nextAssignment.set(varSlotChosen, value);
} else {
//It's only at this point that we get to check...
if(!nextAssignment.get(varSlotChosen).equals(value)) {
//We need to correct the value
//This is wrong! The current tuple may be the constraining tuple.
//But we might need it for performance reasons when there isn't that case...
//TODO: Restore this when we can tell it's appropriate
//incrementSourceToGetValueInSlot(s, nextAssignment.get(varSlotChosen), i);
incrementSource(s);
//updateNextAssignment(); (should be included at end of calling function)
return;
}
}
}
}
for(int i = 0; i < valueIndices.size(); i++) {
if((plan.getValuesToCompute() == null || !plan.getValuesToCompute().containsKey(i))
&& plan.getSourceDefiningSlot().get(i) == -1) {
nextAssignment.set(i, plan.getValuesToIterate().get(i).get(valueIndices.get(i)));
} else if(plan.getSourceDefiningSlot().get(i) == -1) {
//Fill in based on a function
//Note that the values on the left must already be filled in
GdlConstant valueFromFunction = plan.getValuesToCompute().get(i).getValue(nextAssignment);
// System.out.println("Setting based on a function: slot " + i + " to value " + valueFromFunction);
nextAssignment.set(i, valueFromFunction);
}
}
}