Clover coverage report -
Coverage timestamp: jeu. sept. 29 2005 23:57:39 CEST
file stats: LOC: 91   Methods: 6
NCLOC: 55   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
MyOrder.java 75% 82,6% 66,7% 78,4%
coverage coverage
 1    /*
 2    * Created on 6 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.orders;
 8   
 9    import java.util.ArrayList;
 10    import java.util.Collections;
 11   
 12    import org.sat4j.minisat.core.ILits;
 13    import org.sat4j.minisat.core.ILits2;
 14   
 15    /**
 16    * @author leberre To change the template for this generated type comment go to
 17    * Window>Preferences>Java>Code Generation>Code and Comments
 18    */
 19    public class MyOrder extends VarOrder {
 20   
 21    private static final long serialVersionUID = 1L;
 22   
 23    private ILits2 lits;
 24   
 25    class Temp implements Comparable<Temp> {
 26    private int id;
 27   
 28    private int count;
 29   
 30  90 Temp(int id) {
 31  90 this.id = id;
 32  90 count = lits.nBinaryClauses(id) + lits.nBinaryClauses(id ^ 1);
 33    }
 34   
 35  89 public int compareTo(Temp t) {
 36  89 if (count == 0) {
 37  0 return Integer.MAX_VALUE;
 38    }
 39  89 if (t.count == 0) {
 40  0 return -1;
 41    }
 42  89 return count - t.count;
 43    }
 44   
 45  0 @Override
 46    public String toString() {
 47  0 return "" + id + "(" + count + ")";
 48    }
 49    }
 50   
 51    /*
 52    * (non-Javadoc)
 53    *
 54    * @see org.sat4j.minisat.VarOrder#setLits(org.sat4j.minisat.Lits)
 55    */
 56  1 @Override
 57    public void setLits(ILits lits) {
 58  1 super.setLits(lits);
 59  1 this.lits = (ILits2) lits;
 60    }
 61   
 62    /*
 63    * (non-Javadoc)
 64    *
 65    * @see org.sat4j.minisat.IHeuristics#init()
 66    */
 67  1 @Override
 68    public void init() {
 69  1 super.init();
 70  1 ArrayList<Temp> v = new ArrayList<Temp>(order.length);
 71   
 72  1 for (int i = 1; i < order.length; i++) {
 73  90 Temp t = new Temp(order[i]);
 74  90 v.add(t);
 75    }
 76  1 Collections.sort(v);
 77    // System.out.println(v);
 78  1 for (int i = 0; i < v.size(); i++) {
 79  90 Temp t = v.get(i);
 80  90 order[i + 1] = t.id;
 81  90 int index = t.id >> 1;
 82  90 varpos[index] = i + 1;
 83    }
 84  1 lastVar = 1;
 85    }
 86   
 87  0 @Override
 88    public String toString() {
 89  0 return "Init VSIDS order using a POSIT-like static order on 2 and 3 clauses.";
 90    }
 91    }