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