Clover Coverage Report
Coverage timestamp: mer. juin 27 2007 07:27:16 CEST
41   152   7   2,56
20   95   0,54   16
16     1,38  
1    
 
  Heap       Line # 38 41 7 83,1% 0.83116883
 
  (158)
 
1    /*
2    * SAT4J: a SATisfiability library for Java Copyright (C) 2004-2006 Daniel Le Berre
3    *
4    * Based on the original minisat specification from:
5    *
6    * An extensible SAT solver. Niklas E?n and Niklas S?rensson. Proceedings of the
7    * Sixth International Conference on Theory and Applications of Satisfiability
8    * Testing, LNCS 2919, pp 502-518, 2003.
9    *
10    * This library is free software; you can redistribute it and/or modify it under
11    * the terms of the GNU Lesser General Public License as published by the Free
12    * Software Foundation; either version 2.1 of the License, or (at your option)
13    * any later version.
14    *
15    * This library is distributed in the hope that it will be useful, but WITHOUT
16    * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17    * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18    * details.
19    *
20    * You should have received a copy of the GNU Lesser General Public License
21    * along with this library; if not, write to the Free Software Foundation, Inc.,
22    * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23    *
24    */
25    package org.sat4j.minisat.core;
26   
27    import java.io.Serializable;
28   
29    import org.sat4j.core.VecInt;
30    import org.sat4j.specs.IVecInt;
31   
32    /**
33    * Heap implementation used to maintain the variables order in some heuristics.
34    *
35    * @author daniel
36    *
37    */
 
38    public class Heap implements Serializable {
39   
40    /*
41    * default serial version id
42    */
43    private static final long serialVersionUID = 1L;
44   
 
45  1968560138 toggle private final static int left(int i) {
46  1968560138 return i << 1;
47    }
48   
 
49  1744152955 toggle private final static int right(int i) {
50  1744152955 return (i << 1) ^ 1;
51    }
52   
 
53    toggle private final static int parent(int i) {
54    return i >> 1;
55    }
56   
 
57    toggle private final boolean comp(int a, int b) {
58    return activity[a] > activity[b];
59    }
60   
61    private final IVecInt heap = new VecInt(); // heap of ints
62   
63    private final IVecInt indices = new VecInt(); // int -> index in heap
64   
65    private final double[] activity;
66   
 
67  1495322002 toggle @SuppressWarnings("PMD")
68    final void percolateUp(int i) {
69  1495322002 int x = heap.get(i);
70    while (parent(i) != 0 && comp(x, heap.get(parent(i)))) {
71  1077667877 heap.set(i, heap.get(parent(i)));
72  1077667877 indices.set(heap.get(i), i);
73  1077667877 i = parent(i);
74    }
75  1495322002 heap.set(i, x);
76  1495322002 indices.set(x, i);
77    }
78   
 
79  164960036 toggle final void percolateDown(int i) {
80  164960036 int x = heap.get(i);
81  846247051