1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sourceforge.domian.test.benchmark;
17
18
19
20 class ChessPiecePlacing {
21
22
23 private int x, y;
24
25 ChessPiecePlacing(final int x, final int y) {
26 this.x = x;
27 this.y = y;
28 }
29
30 ChessPiecePlacing(final int z) {
31 this.x = z / 8;
32 this.y = z % 8;
33 }
34
35 public int getX() {
36 return this.x;
37 }
38
39 public int getY() {
40 return this.y;
41 }
42
43 @Override
44 public String toString() {
45 StringBuilder builder = new StringBuilder();
46 switch (x) {
47 case 0:
48 builder.append("A");
49 break;
50 case 1:
51 builder.append("B");
52 break;
53 case 2:
54 builder.append("C");
55 break;
56 case 3:
57 builder.append("D");
58 break;
59 case 4:
60 builder.append("E");
61 break;
62 case 5:
63 builder.append("F");
64 break;
65 case 6:
66 builder.append("G");
67 break;
68 case 7:
69 builder.append("H");
70 break;
71 }
72 builder.append(this.y + 1);
73
74 return builder.toString();
75 }
76 }