import kodkod.instance.Bounds; //导入方法依赖的package包/类
/**
* Returns an exact interpreter for the given bounds and options. If
* {@code incremental} is true
, then the resulting interpreter
* can be {@linkplain #extend(Set, Map, Map) extended} with new bindings.
* Otherwise, the interpreter will throw an exception if extension is
* attempted.
*
* @return some l: LeafInterpreter | l.universe = bounds.universe &&
* l.relations = bounds.relations() && l.ints = bounds.ints() &&
* l.lbounds = bounds.lowerBound && l.ubounds = bounds.upperBound &&
* l.ibounds = bounds.intBound && l.factory =
* BooleanFactory.factory(sum(r: l.relations |
* #(l.ubounds[r]-l.lbounds[r]))-1, options) && l.vars[relations] =
* l.factory & BooleanVariable
*/
static final LeafInterpreter exact(Bounds bounds, Options options, boolean incremental) {
final Map vars = new LinkedHashMap();
final Map lowers = incremental ? new LinkedHashMap(bounds.lowerBounds())
: bounds.lowerBounds();
final Map uppers = incremental ? new LinkedHashMap(bounds.upperBounds())
: bounds.upperBounds();
final int numVars = allocateVars(1, vars, bounds.relations(), lowers, uppers);
return new LeafInterpreter(bounds.universe(), lowers, uppers, bounds.intBounds(),
BooleanFactory.factory(numVars, options), vars);
}