Commit 22a0e8f3 authored by leberre's avatar leberre
Browse files

Avoid having a direct dependency to org.sat4j.minisat.SolverFactory in...

Avoid having a direct dependency to org.sat4j.minisat.SolverFactory in AllMuses to avoid cycles between sat4j.tools and sat4j.minisat. The AllMuses class now requires a solver factory as constructor parameter.

git-svn-id: svn+ssh://svn.forge.ow2.org/svnroot/sat4j/maven/trunk@1696 ba638df5-4473-46d1-82f8-c3ae2a17a6e1
parent c4bcc516
......@@ -33,8 +33,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.sat4j.core.ASolverFactory;
import org.sat4j.core.VecInt;
import org.sat4j.minisat.SolverFactory;
import org.sat4j.specs.ContradictionException;
import org.sat4j.specs.ISolver;
import org.sat4j.specs.IVecInt;
......@@ -49,9 +49,11 @@ public class CheckMUSSolutionListener implements SolutionFoundListener {
// public CheckThatItIsAMUS(List<IVecInt> clauses) {
// this.clauses = clauses;
// }
private final ASolverFactory<? extends ISolver> factory;
public CheckMUSSolutionListener() {
public CheckMUSSolutionListener(ASolverFactory<? extends ISolver> factory) {
this.clauses = new ArrayList<IVecInt>();
this.factory = factory;
}
// public void setOriginalClauses(List<IVecInt> clauses) {
......@@ -78,7 +80,7 @@ public class CheckMUSSolutionListener implements SolutionFoundListener {
public boolean checkThatItIsAMUS(IVecInt mus) {
boolean result = false;
ISolver solver = SolverFactory.newDefault();
ISolver solver = factory.defaultSolver();
try {
for (int i = 0; i < mus.size(); i++) {
......@@ -101,7 +103,7 @@ public class CheckMUSSolutionListener implements SolutionFoundListener {
try {
for (int i = 0; i < mus.size(); i++) {
solver = SolverFactory.newDefault();
solver = factory.defaultSolver();
for (int j = 0; j < mus.size(); j++) {
if (j != i) {
solver.addClause(clauses.get(mus.get(j) - 1));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment