-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTile.java
More file actions
65 lines (49 loc) · 1.12 KB
/
Copy pathTile.java
File metadata and controls
65 lines (49 loc) · 1.12 KB
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
/*=====================================
class Tiles
Represents each tile of the game board
=====================================*/
public class Tile {
//========== Instance Variables ==========//
protected String _type;
protected int _length;
protected String _face;
protected boolean _isFaceUp;
//========== Default constructor ==========//
//default tile on a board represents water
public Tile() {
_type = "water";
_length = 1;
_face = " ";
_isFaceUp = false;
}
//========== Constructor ==========//
public Tile( String type, int length, String value ) {
this();
_type = type;
_length = length;
_face = value;
}
//========== METHODS ==========//
//Accessors
public int getLength() {
return _length;
}
public String getFace() {
return _face;
}
public String getType() {
return _type;
}
public boolean isFaceUp() {
return _isFaceUp;
}
public void flip() {
_isFaceUp = !_isFaceUp;
}
public String toString() {
if( _type.equals("axis") || isFaceUp() )
return _face;
else
return " ";
}
}