-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.java
85 lines (73 loc) · 2.69 KB
/
Cell.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
/*****************************************************************
Returns cell state of minesweeper
@author Xue Hua
@version Winter 2019
*****************************************************************/
package MineSweeper;
public class Cell {
/** Checks if Cell is exposed */
private boolean isExposed;
/** Checks if Cell is a mine */
private boolean isMine;
/** Checks if Cell is flagged */
private boolean isFlagged;
/*****************************************************************
Constructor that sets the initial state of each cell when called.
@param exposed sets cell to exposed
@param mine sets cell to mine
@param flagged sets cell to flagged
*****************************************************************/
public Cell(boolean exposed, boolean mine, boolean flagged) {
isExposed = exposed;
isMine = mine;
isFlagged = flagged;
}
/*****************************************************************
Returns if cell is exposed
@param void
@return true if it is exposed
*****************************************************************/
public boolean isExposed() {
return isExposed;
}
/*****************************************************************
Sets cell as exposed
@param exposed set true to expose
@return none
*****************************************************************/
public void setExposed(boolean exposed) {
isExposed = exposed;
}
/*****************************************************************
Returns if cell is a mine
@param void
@return true if it is a mine
*****************************************************************/
public boolean isMine() {
return isMine;
}
/*****************************************************************
Sets cell as a mine
@param mine set true to set as mine
@return none
*****************************************************************/
public void setMine(boolean mine) {
isMine = mine;
}
/*****************************************************************
Returns if cell is flagged
@param void
@return true if it is flagged
*****************************************************************/
public boolean isFlagged() {
return isFlagged;
}
/*****************************************************************
Sets cell as flagged
@param flagged set true to set as flagged
@return none
*****************************************************************/
public void setFlagged(boolean flagged) {
isFlagged = flagged;
}
}