Clover coverage report -
Coverage timestamp: jeu. sept. 29 2005 23:57:39 CEST
file stats: LOC: 199   Methods: 20
NCLOC: 77   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
SolverDecorator.java - 40% 40% 40%
coverage coverage
 1    /*
 2    * Created on 22 mars 2004
 3    *
 4    * To change the template for this generated file go to
 5    * Window>Preferences>Java>Code Generation>Code and Comments
 6    */
 7    package org.sat4j.tools;
 8   
 9    import java.io.PrintStream;
 10    import java.io.Serializable;
 11    import java.math.BigInteger;
 12   
 13    import org.sat4j.specs.ContradictionException;
 14    import org.sat4j.specs.IConstr;
 15    import org.sat4j.specs.ISolver;
 16    import org.sat4j.specs.IVec;
 17    import org.sat4j.specs.IVecInt;
 18    import org.sat4j.specs.TimeoutException;
 19   
 20    /**
 21    * The aim of that class is to allow adding dynamic
 22    * responsabilities to SAT solvers using the Decorator design pattern.
 23    * The class is abstract because it does not makes sense to use it "as
 24    * is".
 25    *
 26    * @author leberre
 27    */
 28    public abstract class SolverDecorator implements ISolver, Serializable {
 29   
 30    /*
 31    * (non-Javadoc)
 32    *
 33    * @see org.sat4j.specs.ISolver#getTimeout()
 34    */
 35  0 public int getTimeout() {
 36  0 return solver.getTimeout();
 37    }
 38   
 39    /*
 40    * (non-Javadoc)
 41    *
 42    * @see org.sat4j.specs.ISolver#toString(java.lang.String)
 43    */
 44  0 public String toString(String prefix) {
 45  0 return solver.toString(prefix);
 46    }
 47   
 48    /*
 49    * (non-Javadoc)
 50    *
 51    * @see org.sat4j.specs.ISolver#printStat(java.io.PrintStream,
 52    * java.lang.String)
 53    */
 54  0 public void printStat(PrintStream out, String prefix) {
 55  0 solver.printStat(out, prefix);
 56    }
 57   
 58    private final ISolver solver;
 59   
 60    /**
 61    *
 62    */
 63  3 public SolverDecorator(ISolver solver) {
 64  3 this.solver = solver;
 65    }
 66   
 67    /*
 68    * (non-Javadoc)
 69    *
 70    * @see org.sat4j.ISolver#newVar()
 71    */
 72  0 public int newVar() {
 73  0 return solver.newVar();
 74    }
 75   
 76    /*
 77    * (non-Javadoc)
 78    *
 79    * @see org.sat4j.ISolver#newVar(int)
 80    */
 81  3 public int newVar(int howmany) {
 82  3 return solver.newVar(howmany);
 83    }
 84   
 85    /*
 86    * (non-Javadoc)
 87    *
 88    * @see org.sat4j.ISolver#addClause(org.sat4j.datatype.VecInt)
 89    */
 90  27 public IConstr addClause(IVecInt literals) throws ContradictionException {
 91  27 return solver.addClause(literals);
 92    }
 93   
 94  0 public void addAllClauses(IVec<IVecInt> clauses)
 95    throws ContradictionException {
 96  0 solver.addAllClauses(clauses);
 97    }
 98   
 99    /*
 100    * (non-Javadoc)
 101    *
 102    * @see org.sat4j.ISolver#addAtMost(org.sat4j.datatype.VecInt, int)
 103    */
 104  13 public IConstr addAtMost(IVecInt literals, int degree)
 105    throws ContradictionException {
 106  13 return solver.addAtMost(literals, degree);
 107    }
 108   
 109    /*
 110    * (non-Javadoc)
 111    *
 112    * @see org.sat4j.ISolver#addAtLeast(org.sat4j.datatype.VecInt, int)
 113    */
 114  0 public IConstr addAtLeast(IVecInt literals, int degree)
 115    throws ContradictionException {
 116  0 return solver.addAtLeast(literals, degree);
 117    }
 118   
 119  0 public IConstr addPseudoBoolean(IVecInt literals, IVec<BigInteger> coeffs,
 120    boolean moreThan, BigInteger degree) throws ContradictionException {
 121  0 return solver.addPseudoBoolean(literals, coeffs, moreThan, degree);
 122    }
 123   
 124    /*
 125    * (non-Javadoc)
 126    *
 127    * @see org.sat4j.ISolver#model()
 128    */
 129  34 public int[] model() {
 130  34 return solver.model();
 131    }
 132   
 133    /*
 134    * (non-Javadoc)
 135    *
 136    * @see org.sat4j.ISolver#isSatisfiable()
 137    */
 138  32 public boolean isSatisfiable() throws TimeoutException {
 139  32 return solver.isSatisfiable();
 140    }
 141   
 142    /*
 143    * (non-Javadoc)
 144    *
 145    * @see org.sat4j.ISolver#isSatisfiable(org.sat4j.datatype.VecInt)
 146    */
 147  5 public boolean isSatisfiable(IVecInt assumps) throws TimeoutException {
 148  5 return solver.isSatisfiable(assumps);
 149    }
 150   
 151    /*
 152    * (non-Javadoc)
 153    *
 154    * @see org.sat4j.ISolver#setTimeout(int)
 155    */
 156  0 public void setTimeout(int t) {
 157  0 solver.setTimeout(t);
 158    }
 159   
 160    /*
 161    * (non-Javadoc)
 162    *
 163    * @see org.sat4j.ISolver#nConstraints()
 164    */
 165  0 public int nConstraints() {
 166  0 return solver.nConstraints();
 167    }
 168   
 169    /*
 170    * (non-Javadoc)
 171    *
 172    * @see org.sat4j.ISolver#nVars()
 173    */
 174  52 public int nVars() {
 175  52 return solver.nVars();
 176    }
 177   
 178    /*
 179    * (non-Javadoc)
 180    *
 181    * @see org.sat4j.ISolver#reset()
 182    */
 183  0 public void reset() {
 184  0 solver.reset();
 185    }
 186   
 187  0 public ISolver decorated() {
 188  0 return solver;
 189    }
 190   
 191    /*
 192    * (non-Javadoc)
 193    *
 194    * @see org.sat4j.specs.ISolver#removeConstr(org.sat4j.minisat.core.Constr)
 195    */
 196  0 public boolean removeConstr(IConstr c) {
 197  0 return solver.removeConstr(c);
 198    }
 199    }