-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.java
101 lines (74 loc) · 1.67 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
public class Cell {
private char value = '-';
private boolean blocked = false;
private int blockNumber = 0;
public int getBlockNumber() {
return blockNumber;
}
public void setBlockNumber(int blockNumber) {
this.blockNumber = blockNumber;
}
private boolean[] neighbors = {false, false, false, false};
public Cell(){
}
public Cell(char c){
value = c;
}
public Cell(Cell c){
this.value = c.getValue();
this.blocked = c.getBlocked();
this.setNorth(c.getNorth());
this.setEast(c.getEast());
this.setSouth(c.getSouth());
this.setWest(c.getWest());
}
public Cell(char c, boolean north, boolean east, boolean south, boolean west){
value = c;
neighbors[0] = north;
neighbors[1] = east;
neighbors[2] = south;
neighbors[3] = west;
}
public char getValue(){
return value;
}
public void setValue(char value) {
this.value = value;
}
public void setNeighbors(boolean[] neighbors) {
this.neighbors = neighbors;
}
public boolean getBlocked(){
return blocked;
}
public boolean[] getNeighbors(){
return neighbors;
}
public boolean getNorth(){
return neighbors[0];
}
public boolean getEast(){
return neighbors[1];
}
public boolean getSouth(){
return neighbors[2];
}
public boolean getWest(){
return neighbors[3];
}
public void setBlocked(boolean b){
blocked = b;
}
public void setNorth(boolean b){
neighbors[0] = b;
}
public void setEast(boolean b){
neighbors[1] = b;
}
public void setSouth(boolean b){
neighbors[2] = b;
}
public void setWest(boolean b){
neighbors[3] = b;
}
}