* to be solved, and the way in which the underlying acyclic graph is explored
* depends on the selected solver strategy.
*/
void solve(GraphStrategy sstrategy) {
checkWithinBounds(inferenceContext, warn); //initial propagation of bounds
InferenceGraph inferenceGraph = new InferenceGraph(stuckDeps);
while (!sstrategy.done()) {
InferenceGraph.Node nodeToSolve = sstrategy.pickNode(inferenceGraph);
List<Type> varsToSolve = List.from(nodeToSolve.data);
List<Type> saved_undet = inferenceContext.save();
try {
//repeat until all variables are solved
outer: while (Type.containsAny(inferenceContext.restvars(), varsToSolve)) {
//for each inference phase
for (GraphInferenceSteps step : GraphInferenceSteps.values()) {
if (inferenceContext.solveBasic(varsToSolve, step.steps)) {
checkWithinBounds(inferenceContext, warn);
continue outer;
}
}
//no progress
throw inferenceException.setMessage();
}
}
catch (InferenceException ex) {
//did we fail because of interdependent ivars?
inferenceContext.rollback(saved_undet);
instantiateAsUninferredVars(varsToSolve, inferenceContext);
checkWithinBounds(inferenceContext, warn);
}
inferenceGraph.deleteNode(nodeToSolve);
}
}