EMMA Coverage Report (generated Sat Aug 20 11:00:51 CDT 2011)
[all classes][tuffy.ground.partition]

COVERAGE SUMMARY FOR SOURCE FILE [Component.java]

nameclass, %method, %block, %line, %
Component.java100% (1/1)86%  (6/7)65%  (90/138)75%  (24/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Component100% (1/1)86%  (6/7)65%  (90/138)75%  (24/32)
showStats (): void 0%   (0/1)0%   (0/48)0%   (0/8)
Component (): void 100% (1/1)100% (40/40)100% (12/12)
addAtom (GAtom): void 100% (1/1)100% (9/9)100% (2/2)
compareTo (Component): int 100% (1/1)100% (10/10)100% (2/2)
discard (): void 100% (1/1)100% (24/24)100% (6/6)
numParts (): int 100% (1/1)100% (4/4)100% (1/1)
size (): double 100% (1/1)100% (3/3)100% (1/1)

1package tuffy.ground.partition;
2 
3 
4import java.util.ArrayList;
5import java.util.HashMap;
6import java.util.HashSet;
7 
8import tuffy.infer.ds.GAtom;
9import tuffy.util.UIMan;
10/**
11 * A component in the MRF.
12 */
13 
14public class Component implements Comparable<Component>{
15        public int id = 0;
16        public int rep = 0; // representative atom id
17        public int numAtoms = 0;
18        public int numClauses = 0;
19        public int numCutClauses = 0;
20        public int numPins = 0;
21        public double totalWeight = 0;
22        public double totalCutWeight = 0;
23        public double ramSize = 0;
24 
25        // partitions in this component; maybe only one
26        public ArrayList<Partition> parts = new ArrayList<Partition>();
27        // atoms that are at the boundary
28        public HashSet<Integer> cutset = new HashSet<Integer>();
29 
30        // aid --> atom
31        public HashMap<Integer, GAtom> atoms;
32 
33 
34        /**
35         * Add a new atom into this component.
36         * @param a the atom
37         */
38        public void addAtom(GAtom a){
39                atoms.put(a.id, a);
40        }
41        
42        /**
43         * Discard all data structures to reclaim the RAM.
44         */
45        public void discard(){
46                cutset.clear();
47                atoms.clear();
48                atoms = null;
49                for(Partition p : parts){
50                        p.discard();
51                }
52        }
53        
54        /**
55         * Show basic stats of this component.
56         */
57        public void showStats(){
58                String s = "[Component #" + id + "]" +
59                "\n\tRAM = " + ramSize + " bytes" +
60                "\n\t#parts = " + parts.size() + 
61                "\n\t#atoms = " + numAtoms +
62                "\n\t#clauses = " + numClauses +
63                "\n\t#cut_atoms = " + cutset.size();
64                UIMan.println(s);
65        }
66        
67        public int compareTo(Component c){
68                double d = c.size() - size();
69                return (int)(Math.signum(d));
70        }
71        
72        /**
73         * The size of this component estimated in
74         * the number fo bytes consumed to store this component in RAM.
75         */
76        public double size(){
77                return ramSize;
78        }
79        
80        /**
81         * Get the number of partitions in this component.
82         */
83        public int numParts(){
84                return parts.size();
85        }
86}

[all classes][tuffy.ground.partition]
EMMA 2.0.5312 EclEmma Fix 2 (C) Vladimir Roubtsov