01: // Modified or written by Object Mentor, Inc. for inclusion with FitNesse.
02: // Copyright (c) 2002 Cunningham & Cunningham, Inc.
03: // Released under the terms of the GNU General Public License version 2 or later.
04: package fit;
05:
06: public class Counts {
07: public int right = 0;
08: public int wrong = 0;
09: public int ignores = 0;
10: public int exceptions = 0;
11:
12: public Counts(int right, int wrong, int ignores, int exceptions) {
13: this .right = right;
14: this .wrong = wrong;
15: this .ignores = ignores;
16: this .exceptions = exceptions;
17: }
18:
19: public Counts() {
20: }
21:
22: public String toString() {
23: return right + " right, " + wrong + " wrong, " + ignores
24: + " ignored, " + exceptions + " exceptions";
25: }
26:
27: public void tally(Counts source) {
28: right += source.right;
29: wrong += source.wrong;
30: ignores += source.ignores;
31: exceptions += source.exceptions;
32: }
33:
34: public boolean equals(Object o) {
35: if (o == null || !(o instanceof Counts))
36: return false;
37: Counts other = (Counts) o;
38: return right == other.right && wrong == other.wrong
39: && ignores == other.ignores
40: && exceptions == other.exceptions;
41: }
42:
43: public void tallyPageCounts(Counts counts) {
44: if (counts.wrong > 0)
45: wrong += 1;
46: else if (counts.exceptions > 0)
47: exceptions += 1;
48: else if (counts.ignores > 0 && counts.right == 0)
49: ignores += 1;
50: else
51: right += 1;
52: }
53: }
|