1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package net.sf.clirr.ant;
21
22 import net.sf.clirr.core.ApiDifference;
23 import net.sf.clirr.core.Severity;
24 import net.sf.clirr.core.DiffListenerAdapter;
25
26
27 final class ChangeCounter extends DiffListenerAdapter
28 {
29 private int binInfos = 0;
30 private int binWarnings = 0;
31 private int binErrors = 0;
32
33 private int srcInfos = 0;
34 private int srcWarnings = 0;
35 private int srcErrors = 0;
36
37
38 public ChangeCounter()
39 {
40 }
41
42 public int getBinInfos()
43 {
44 return binInfos;
45 }
46
47 public int getBinWarnings()
48 {
49 return binWarnings;
50 }
51
52 public int getBinErrors()
53 {
54 return binErrors;
55 }
56
57 public int getSrcInfos()
58 {
59 return srcInfos;
60 }
61
62 public int getSrcWarnings()
63 {
64 return srcWarnings;
65 }
66
67 public int getSrcErrors()
68 {
69 return srcErrors;
70 }
71
72 public void reportDiff(ApiDifference difference)
73 {
74 final Severity binSeverity = difference.getBinaryCompatibilitySeverity();
75 if (Severity.ERROR.equals(binSeverity))
76 {
77 binErrors += 1;
78 }
79 else if (Severity.WARNING.equals(binSeverity))
80 {
81 binWarnings += 1;
82 }
83 else if (Severity.INFO.equals(binSeverity))
84 {
85 binInfos += 1;
86 }
87
88 final Severity srcSeverity = difference.getSourceCompatibilitySeverity();
89 if (Severity.ERROR.equals(srcSeverity))
90 {
91 srcErrors += 1;
92 }
93 else if (Severity.WARNING.equals(srcSeverity))
94 {
95 srcWarnings += 1;
96 }
97 else if (Severity.INFO.equals(srcSeverity))
98 {
99 srcInfos += 1;
100 }
101
102 }
103
104 }