-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmpty.java
108 lines (101 loc) · 2.03 KB
/
Empty.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/**
* Write a description of class Piece here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Empty extends Pieces
{
protected String name;
protected int row;
protected String column;
protected String color;
public Empty(String name, String color)
{
super(name,color);
this.name = name;
this.color = color;
}
public String getColor()
{
return color;
}
public void setColor(String color)
{
this.color = color;
}
public void setName(String name)
{
this.name = name;
}
public int convertColumn(String pos)
{
if (pos.substring(0,1).equalsIgnoreCase("A"))
{
return 0;
}
else if (pos.substring(0,1).equalsIgnoreCase("B"))
{
return 1;
}
else if (pos.substring(0,1).equalsIgnoreCase("C"))
{
return 2;
}
else if (pos.substring(0,1).equalsIgnoreCase("D"))
{
return 3;
}
else if (pos.substring(0,1).equalsIgnoreCase("E"))
{
return 4;
}
else if (pos.substring(0,1).equalsIgnoreCase("F"))
{
return 5;
}
else if (pos.substring(0,1).equalsIgnoreCase("G"))
{
return 6;
}
else
{
return 7;
}
}
public String unConvertColumn(int pos)
{
if (pos == 0)
{
return "A";
}
else if (pos == 1)
{
return "B";
}
else if (pos == 2)
{
return "C";
}
else if (pos == 3)
{
return "D";
}
else if (pos == 4)
{
return "E";
}
else if (pos == 5)
{
return "F";
}
else if (pos == 6)
{
return "G";
}
else
{
return "H";
}
}
}