01: package eg;
02:
03: // Copyright (c) 2002 Cunningham & Cunningham, Inc.
04: // Released under the terms of the GNU General Public License version 2 or later.
05:
06: import fit.*;
07:
08: public class ArithmeticFixture extends PrimitiveFixture {
09:
10: int x = 0;
11: int y = 0;
12:
13: public void doRows(Parse rows) {
14: super .doRows(rows.more); // skip column heads
15: }
16:
17: public void doCell(Parse cell, int column) {
18: switch (column) {
19: case 0:
20: x = (int) parseLong(cell);
21: break;
22: case 1:
23: y = (int) parseLong(cell);
24: break;
25: case 2:
26: check(cell, x + y);
27: break;
28: case 3:
29: check(cell, x - y);
30: break;
31: case 4:
32: check(cell, x * y);
33: break;
34: case 5:
35: check(cell, x / y);
36: break;
37: default:
38: ignore(cell);
39: break;
40: }
41: }
42: }
|