-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquare.java
More file actions
74 lines (63 loc) · 1.3 KB
/
Square.java
File metadata and controls
74 lines (63 loc) · 1.3 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
66
67
68
69
70
71
72
73
74
public class Square
{
public static final int EMPTY = 0;
public static final int WALL = 1;
public static final int START = 2;
public static final int EXIT = 3;
private int type;
private int row, col;
private char status;
private Square previous;
public Square(int row, int col, int type)
{
this.row = row;
this.col = col;
this.type = type;
previous = null;
}
public String toString()
{
if(type == 0) return "" + status;
if(type == 1) return "#";
if(type == 2) return "S";
else return "E";
}
public boolean equals(Object obj)
{
Square temp = (Square) obj;
return temp.getRow() == row && temp.getCol() == col;
}
public int getRow()
{
return row;
}
public int getCol()
{
return col;
}
public int getType()
{
return type;
}
public char getStatus()
{
return status;
}
public void setStatus(char c)
{
status = c;
}
public void reset()
{
status = '_';
previous = null;
}
public Square getPrevious()
{
return previous;
}
public void setPrevious(Square s)
{
previous = s;
}
}