@@ -0,0 +1,2318 @@
+package hu.webarticum.jsatbuilder.satbuilder.common;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.IdentityHashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport hu.webarticum.jsatbuilder.sat.Solver;%0Aimport hu.webarticum.jsatbuilder.satbuilder.core.AbstractConstraint;%0Aimport hu.webarticum.jsatbuilder.satbuilder.core.CollapseException;%0Aimport hu.webarticum.jsatbuilder.satbuilder.core.Definition;%0A%0Apublic class GeneralClauseSetConstraint extends AbstractConstraint %7B%0A    %0A    private final List%3CList%3CDefinitionLiteral%3E%3E clauses;%0A    %0A    private final Definition condition;%0A    %0A    public GeneralClauseSetConstraint(boolean required, Collection%3C? extends Collection%3CDefinitionLiteral%3E%3E clauses, Definition condition) %7B%0A        super(required);%0A        this.clauses = new ArrayList%3CList%3CDefinitionLiteral%3E%3E();%0A        for (Collection%3CDefinitionLiteral%3E clause: clauses) %7B%0A            this.clauses.add(new ArrayList%3CDefinitionLiteral%3E(clause));%0A        %7D%0A        this.condition = condition;%0A        for (Definition definition: getDependencies()) %7B%0A            getDependencyManager().linkDependency(definition);%0A        %7D%0A    %7D%0A%0A    @Override%0A    public List%3CDefinition%3E getDependencies() %7B%0A        Map%3CDefinition, Object%3E dependencies = new IdentityHashMap%3CDefinition, Object%3E();%0A        for (List%3CDefinitionLiteral%3E clause: clauses) %7B%0A            for (DefinitionLiteral literal: clause) %7B%0A                dependencies.put(literal.getDefinition(), null);%0A            %7D%0A        %7D%0A        if (condition != null) %7B%0A            dependencies.put(condition, null);%0A        %7D%0A        return new ArrayList%3CDefinition%3E(dependencies.keySet());%0A    %7D%0A%0A    @Override%0A    public void dependencyRemoved(Definition definition) throws CollapseException %7B%0A        // XXX%0A        remove();%0A    %7D%0A%0A    @Override%0A    public void fillSolver(Solver solver) %7B%0A        for (List%3CDefinitionLiteral%3E clause: clauses) %7B%0A            Solver.Clause solverClause = new Solver.Clause();%0A            if (condition != null) %7B%0A                solverClause.addLiteral(new Solver.Literal(condition, false));%0A            %7D%0A            for (DefinitionLiteral literal: clause) %7B%0A                solverClause.addLiteral(literal.toSolverLiteral());%0A            %7D%0A            solver.add(solverClause);%0A        %7D%0A    %7D%0A    %0A%7D%0A

Add GeneralClauseSetConstraint