Clover coverage report -
Coverage timestamp: jeu. juin 15 2006 08:24:33 CEST
file stats: LOC: 98   Methods: 6
NCLOC: 56   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
AbstractPBDataStructureFactory.java 100% 72,7% 66,7% 73,7%
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.PBConstr;
 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   
 29   
 30  1003704 public Constr createClause(IVecInt literals) throws ContradictionException {
 31  1003704 IVecInt v = WLClause.sanityCheck(literals, getVocabulary(), solver);
 32  1003704 if (v == null)
 33  52 return null;
 34  1003652 IVecInt coefs = new VecInt(v.size(), 1);
 35  1003652 return constraintFactory(v, coefs, true, 1);
 36    }
 37   
 38   
 39   
 40   
 41  12860043 public Constr createUnregisteredClause(IVecInt literals) {
 42  12860043 return new WLClause(literals, getVocabulary());
 43    }
 44   
 45  0 @Override
 46    public Constr createCardinalityConstraint(IVecInt literals, int degree)
 47    throws ContradictionException {
 48  0 IVecInt coefs = new VecInt(literals.size(), 1);
 49  0 return constraintFactory(literals, coefs, true, degree);
 50    }
 51   
 52  1675145 @Override
 53    public Constr createPseudoBooleanConstraint(IVecInt literals,
 54    IVec<BigInteger> coefs, boolean moreThan, BigInteger degree)
 55    throws ContradictionException {
 56  1675145 return constraintFactory(literals, coefs, moreThan, degree);
 57    }
 58   
 59    /**
 60    * @param literals
 61    * @param coefs
 62    * @param moreThan
 63    * @param degree
 64    * @return
 65    */
 66    protected abstract PBConstr constraintFactory(IVecInt literals,
 67    IVecInt coefs, boolean moreThan, int degree)
 68    throws ContradictionException;
 69   
 70    protected abstract PBConstr constraintFactory(IVecInt literals,
 71    IVec<BigInteger> coefs, boolean moreThan, BigInteger degree)
 72    throws ContradictionException;
 73   
 74  519009 @Override
 75    public Constr createUnregisteredPseudoBooleanConstraint(IVecInt literals,
 76    IVec<BigInteger> coefs, BigInteger degree) {
 77  519009 return constraintFactory(literals, coefs, degree);
 78    }
 79   
 80  0 public IConstr createUnregisteredPseudoBooleanConstraint(IVecInt literals,
 81    IVec<BigInteger> coefs, boolean moreThan, BigInteger degree)
 82    throws ContradictionException {
 83  0 return constraintFactory(literals, coefs, moreThan, degree);
 84    }
 85   
 86    /**
 87    * @param literals
 88    * @param coefs
 89    * @param degree
 90    * @return
 91    */
 92    protected abstract PBConstr constraintFactory(IVecInt literals,
 93    IVecInt coefs, int degree);
 94   
 95    protected abstract PBConstr constraintFactory(IVecInt literals,
 96    IVec<BigInteger> coefs, BigInteger degree);
 97   
 98    }