Clover coverage report -
Coverage timestamp: jeu. sept. 29 2005 23:57:39 CEST
file stats: LOC: 97   Methods: 7
NCLOC: 59   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AbstractPBDataStructureFactory.java 100% 72,7% 71,4% 75%
coverage coverage
 1    /*
 2    * Created on 21 juin 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.minisat.constraints;
 8   
 9    import java.math.BigInteger;
 10   
 11    import org.sat4j.core.VecInt;
 12    import org.sat4j.minisat.constraints.cnf.WLClause;
 13    import org.sat4j.minisat.constraints.pb.IInternalPBConstraintCreator;
 14    import org.sat4j.minisat.constraints.pb.WatchPb;
 15    import org.sat4j.minisat.core.Constr;
 16    import org.sat4j.specs.ContradictionException;
 17    import org.sat4j.specs.IConstr;
 18    import org.sat4j.specs.IVec;
 19    import org.sat4j.specs.IVecInt;
 20   
 21    /**
 22    * @author leberre To change the template for this generated type comment go to
 23    * Window>Preferences>Java>Code Generation>Code and Comments
 24    */
 25    public abstract class AbstractPBDataStructureFactory extends
 26    AbstractDataStructureFactory implements IInternalPBConstraintCreator {
 27   
 28  998724 public Constr createClause(IVecInt literals) throws ContradictionException {
 29  998724 IVecInt v = WLClause.sanityCheck(literals, getVocabulary(), solver);
 30  998724 if (v == null)
 31  52 return null;
 32  998672 IVecInt coefs = new VecInt(v.size(), 1);
 33  998672 return constraintFactory(v, coefs, true, 1);
 34    }
 35   
 36  12019772 public Constr createUnregisteredClause(IVecInt literals) {
 37  12019772 return new WLClause(literals, getVocabulary());
 38    }
 39   
 40  0 @Override
 41    public Constr createCardinalityConstraint(IVecInt literals, int degree)
 42    throws ContradictionException {
 43  0 IVecInt coefs = new VecInt(literals.size(), 1);
 44  0 return constraintFactory(literals, coefs, true, degree);
 45    }
 46   
 47  560736 @Override
 48    public Constr createPseudoBooleanConstraint(IVecInt literals,
 49    IVec<BigInteger> coefs, boolean moreThan, BigInteger degree)
 50    throws ContradictionException {
 51  560736 return constraintFactory(literals, coefs, moreThan, degree);
 52    }
 53   
 54    /**
 55    * @param literals
 56    * @param coefs
 57    * @param moreThan
 58    * @param degree
 59    * @return
 60    */
 61    protected abstract WatchPb constraintFactory(IVecInt literals,
 62    IVecInt coefs, boolean moreThan, int degree)
 63    throws ContradictionException;
 64   
 65    protected abstract WatchPb constraintFactory(IVecInt literals,
 66    IVec<BigInteger> coefs, boolean moreThan, BigInteger degree)
 67    throws ContradictionException;
 68   
 69  684 @Override
 70    public void reset() {
 71    }
 72   
 73  62462 @Override
 74    public Constr createUnregisteredPseudoBooleanConstraint(IVecInt literals,
 75    IVec<BigInteger> coefs, BigInteger degree) {
 76  62462 return constraintFactory(literals, coefs, degree);
 77    }
 78   
 79  0 public IConstr createUnregisteredPseudoBooleanConstraint(IVecInt literals,
 80    IVec<BigInteger> coefs, boolean moreThan, BigInteger degree)
 81    throws ContradictionException {
 82  0 return constraintFactory(literals, coefs, moreThan, degree);
 83    }
 84   
 85    /**
 86    * @param literals
 87    * @param coefs
 88    * @param degree
 89    * @return
 90    */
 91    protected abstract WatchPb constraintFactory(IVecInt literals,
 92    IVecInt coefs, int degree);
 93   
 94    protected abstract WatchPb constraintFactory(IVecInt literals,
 95    IVec<BigInteger> coefs, BigInteger degree);
 96   
 97    }