1 package net.jaekl.cfb.analyze;
3 import java.util.HashSet;
5 import net.jaekl.cfb.xml.BugInstance;
7 // Compute and store the delta (difference) between two analyses
10 HashSet<BugInstance> m_fixed; // bugs that have been fixed
11 HashSet<BugInstance> m_common; // bugs that are present in both versions
12 HashSet<BugInstance> m_new; // bugs introduced in the new version
14 public Delta(Analysis before, Analysis after)
16 m_fixed = new HashSet<BugInstance>();
17 m_common = new HashSet<BugInstance>();
18 m_new = new HashSet<BugInstance>();
20 computeDelta(before, after);
23 public BugInstance[] getFixed() { return m_fixed.toArray(new BugInstance[m_fixed.size()]); }
24 public int getNumFixed() { return m_fixed.size(); }
26 public BugInstance[] getCommon() { return m_common.toArray(new BugInstance[m_common.size()]); }
27 public int getNumCommon() { return m_common.size(); }
29 public BugInstance[] getNew() { return m_new.toArray(new BugInstance[m_new.size()]); }
30 public int getNumNew() { return m_new.size(); }
32 void computeDelta(Analysis before, Analysis after)
38 HashSet<BugInstance> beforeBugs = new HashSet<BugInstance>();
40 beforeBugs.addAll(before.getBugCollection().getBugs());
42 for (BugInstance bug : after.getBugCollection().getBugs()) {
43 if (beforeBugs.contains(bug)) {
51 for (BugInstance bug : before.getBugCollection().getBugs()) {
52 if (! m_common.contains(bug)) {