-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLogicalCoordinates.java
64 lines (55 loc) · 1.12 KB
/
LogicalCoordinates.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
package gobang;
/**
* <p> 逻辑坐标 </p>
*
* @author 汤卫豪
* @version V1.0
* @projectName OOP
* @package gobang
* @className Point
* @date 2021/9/22 10:27
**/
public class LogicalCoordinates {
/**
* 行号
*/
private int row;
/**
* 列号
*/
private int col;
public int getRow() {
return row;
}
public void setRow(int row) {
this.row = row;
}
public int getCol() {
return col;
}
public void setCol(int col) {
this.col = col;
}
public LogicalCoordinates() {
}
public LogicalCoordinates(int row, int col) {
this.row = row;
this.col = col;
}
/**
* <p> 将字符串解析成逻辑坐标 </p>
*
* @param str
* @return gobang.LogicalCoordinates
* @author 汤卫豪
* @since 2021/9/29
*/
public static LogicalCoordinates parser(String str) {
String[] s = str.split(":");
return new LogicalCoordinates(Integer.parseInt(s[0]), Integer.parseInt(s[1]));
}
@Override
public String toString() {
return row + ":" + col;
}
}