-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSquare.java
More file actions
44 lines (38 loc) · 716 Bytes
/
Copy pathSquare.java
File metadata and controls
44 lines (38 loc) · 716 Bytes
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
/**
* This class represents one space on the chessboard and its occupying piece.
*/
public class Square
{
int rank;
String file;
Piece piece;
/**
* Constructor for objects of class Square
*/
public Square(int rank, String file)
{
this.rank = rank;
this.file = file;
this.piece = null;
}
public void setPiece(Piece piece)
{
this.piece = piece;
}
/**
*
*/
public boolean containsPiece()
{
return (piece != null);
}
public int getRank(){
return rank;
}
public String getFile(){
return file;
}
public Piece getPiece() {
return this.piece;
}
}