KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > demo > interceptors > gridImpl


1 package demo.interceptors;
2
3 import demo.interceptors.MyServerPackage.MyException;
4
5 public class gridImpl
6     extends MyServerPOA
7 {
8     protected short height = 31;
9     protected short width = 14;
10     protected java.math.BigDecimal JavaDoc[][] mygrid;
11
12     public gridImpl()
13     {
14     mygrid = new java.math.BigDecimal JavaDoc[height][width];
15     for( short h = 0; h < height; h++ )
16         for( short w = 0; w < width; w++ )
17         mygrid[h][w] = new java.math.BigDecimal JavaDoc("0.21");
18     }
19
20     public java.math.BigDecimal JavaDoc get(short n, short m)
21     {
22     if( ( n <= height ) && ( m <= width ) )
23         return mygrid[n][m];
24     else
25         return new java.math.BigDecimal JavaDoc("0.01");
26     }
27
28     public short height()
29     {
30     // System.out.println("height: " + height );
31
return height;
32     }
33
34     public void set(short n, short m, java.math.BigDecimal JavaDoc value)
35     {
36     if( ( n <= height ) && ( m <= width ) )
37         mygrid[n][m] = value;
38     }
39
40     public short width()
41     {
42     return width;
43     }
44
45     public short opWithException()
46     throws MyException
47     {
48     throw new MyException("This is only a test exception, no harm done :-)");
49     }
50
51
52
53 }
54
55
56
Popular Tags