@@ -0,0 +1,2159 @@
+package hu.webarticum.jsatbuilder.satbuilder.common;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%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.Constraint;%0Aimport hu.webarticum.jsatbuilder.satbuilder.core.Definition;%0Aimport hu.webarticum.jsatbuilder.satbuilder.core.Variable;%0A%0A%0Apublic class ConditionVariable extends Variable %7B%0A    %0A    private final InnerConstraint constraint;%0A    %0A    public ConditionVariable() %7B%0A        this(false);%0A    %7D%0A%0A    public ConditionVariable(boolean conditionRequired) %7B%0A        this(conditionRequired, conditionRequired ? null : Solver.CLAUSE_PRIORITY.MEDIUM);%0A    %7D%0A%0A    public ConditionVariable(Solver.CLAUSE_PRIORITY priority) %7B%0A        this(false, priority);%0A    %7D%0A%0A    public ConditionVariable(boolean conditionRequired, Solver.CLAUSE_PRIORITY priority) %7B%0A        this.constraint = new InnerConstraint(conditionRequired, priority);%0A    %7D%0A    %0A    public Constraint getConstraint() %7B%0A        return constraint;%0A    %7D%0A    %0A    private class InnerConstraint extends AbstractConstraint %7B%0A%0A        final Solver.CLAUSE_PRIORITY priority;%0A        %0A        public InnerConstraint(boolean required, Solver.CLAUSE_PRIORITY priority) %7B%0A            super(required);%0A            this.priority = priority;%0A            getDependencyManager().linkDependency(ConditionVariable.this);%0A        %7D%0A%0A        @Override%0A        public List%3CDefinition%3E getDependencies() %7B%0A            return Arrays.%3CDefinition%3EasList(ConditionVariable.this);%0A        %7D%0A%0A        @Override%0A        public void dependencyRemoved(Definition definition) throws CollapseException %7B%0A            remove();%0A        %7D%0A%0A        @Override%0A        public void fillSolver(Solver solver) %7B%0A            Solver.Clause clause = new Solver.Clause(new Solver.Literal(ConditionVariable.this, true));%0A            if (priority == null) %7B%0A                solver.add(clause);%0A            %7D else %7B%0A                solver.addOptional(clause, priority);%0A            %7D%0A        %7D%0A        %0A    %7D%0A    %0A%7D%0A

Add ConditionVariable