start of new file
[IRC.git] / Robust / src / Benchmarks / TileSearch / Java / Tile.java
1 public class Tile {
2     public Tile( int n, int s, int e, int w ) {
3         this.n = n;
4         this.s = s;
5         this.e = e;
6         this.w = w;
7     }
8
9     // value of tile faces
10     int n, s, e, w;
11
12     public Tile copy() {
13         Tile t = new Tile( n, s, e, w );
14         return t;
15     }
16
17     public void printTile() {
18         printRow0(); System.printString("\n");
19         printRow1(); System.printString("\n");
20         printRow2(); System.printString("\n");
21         printRow3(); System.printString("\n");
22         printRow4(); System.printString("\n");
23     }
24
25     public void printRow0(){ System.printString( "+-------+" ); }
26     public void printRow1(){ if( n < 0 ) {
27                           System.printString( "|  " );
28                         } else {
29                           System.printString( "|   " ); }
30                         System.printInt( n );
31                         System.printString(      "   |" ); }
32     public void printRow2(){ if( w < 0 ) {
33                           System.printString( "|" );
34                         } else {
35                           System.printString( "| " ); }
36                         System.printInt( w );
37                         if( e < 0 ) {
38                           System.printString(    "  " );
39                         } else {
40                           System.printString(    "   " ); }
41                         System.printInt( e );
42                         System.printString(        " |" ); }
43     public void printRow3(){ if( s < 0 ) {
44                           System.printString( "|  " );
45                         } else {
46                           System.printString( "|   " ); }
47                         System.printInt( s );
48                         System.printString(      "   |" ); }
49     public void printRow4(){ System.printString( "+-------+" ); }
50
51     // position in the grid
52     // this information is also represented by
53     // the indices into a TileGrid, but it is
54     // convenient to duplicate it
55     int x, y;
56 }