01: package demo.grid;
02:
03: /**
04: * A very simple implementation of a 2-D grid
05: */
06:
07: import demo.grid.MyServerPackage.MyException;
08:
09: public class gridImpl extends MyServerPOA {
10: protected short height = 31;
11: protected short width = 14;
12: protected java.math.BigDecimal[][] mygrid;
13:
14: public gridImpl() {
15: mygrid = new java.math.BigDecimal[height][width];
16: for (short h = 0; h < height; h++) {
17: for (short w = 0; w < width; w++) {
18: mygrid[h][w] = new java.math.BigDecimal("0.21");
19: }
20: }
21: }
22:
23: public java.math.BigDecimal get(short n, short m) {
24: if ((n <= height) && (m <= width))
25: return mygrid[n][m];
26: else
27: return new java.math.BigDecimal("0.01");
28: }
29:
30: public short height() {
31: return height;
32: }
33:
34: public void set(short n, short m, java.math.BigDecimal value) {
35: if ((n <= height) && (m <= width))
36: mygrid[n][m] = value;
37: }
38:
39: public short width() {
40: return width;
41: }
42:
43: public short opWithException()
44: throws demo.grid.MyServerPackage.MyException {
45: throw new demo.grid.MyServerPackage.MyException(
46: "This is only a test exception, no harm done :-)");
47: }
48:
49: }
|