-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tile.java
76 lines (68 loc) · 1.49 KB
/
Tile.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
/**
* Tile object. Each position on gameboard. Has horizontal and vertical
* coordinates as well as color value
*
* @author Chae Jubb
* @version 1.0
*
*/
@SuppressWarnings("serial")
public class Tile implements Location, java.io.Serializable {
private int horizontal, vertical;
private int color; // correspond to player number
/**
* Constructor: Creates tile with supplied coordinates and default color 0
*
* @param x
* Horizontal coordinate of tile to be created
* @param y
* Vertical coordinate fo tile to be created
*/
public Tile(int x, int y) {
this.horizontal = x;
this.vertical = y;
this.color = 0;
}
/**
* Setter for color value of tile
*
* @param newColor
* New color value
*/
public void setColor(int newColor) {
this.color = newColor;
}
/**
* Getter for color value of tile
*
* @return current color value of tile
*/
public int getColor() {
return this.color;
}
/**
* Getter for horizontal coordinate of object
*
* @return Horizontal coordinate
*/
@Override
public int getHorizontal() {
// TODO Auto-generated method stub
return this.horizontal;
}
/**
* Getter for vertical coordinate of object
*
* @return Vertical coordinate
*/
@Override
public int getVertical() {
// TODO Auto-generated method stub
return this.vertical;
}
public String toString() {
return Integer.toString(this.horizontal)
+ Integer.toString(this.vertical)
+ Integer.toString(this.color);
}
}