* @param declConstraints the constraints implied by the declarations; should be Boolean.TRUE intially
* @param values integer values computed so far
*/
private final void sum(Decls decls, IntExpression expr, int currentDecl, BooleanValue declConstraints,
List<Int> values) {
final BooleanFactory factory = interpreter.factory();
if (decls.size()==currentDecl) {
values.add( expr.accept(this).choice(declConstraints, factory.integer(0)) );
return;
}
final Decl decl = decls.get(currentDecl);
final BooleanMatrix declTransl = visit(decl);
final BooleanMatrix groundValue = factory.matrix(declTransl.dimensions());
env = env.extend(decl.variable(), groundValue);
for(IndexedEntry<BooleanValue> entry : declTransl) {
groundValue.set(entry.index(), BooleanConstant.TRUE);
sum(decls, expr, currentDecl+1, factory.and(entry.value(), declConstraints), values);
groundValue.set(entry.index(), BooleanConstant.FALSE);
}
env = env.parent();
}