Updated 'Node' class.
Updated the 'Node' class by overload the 'isOccupied' method in it.
This commit is contained in:
@@ -49,4 +49,14 @@ public void clearOccupant() {
|
|||||||
public boolean isOccupied() {
|
public boolean isOccupied() {
|
||||||
return occupant != null;
|
return occupant != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to check if the node is occupied by a piece of the given color.
|
||||||
|
*
|
||||||
|
* @param color as the color of the piece as a Color object.
|
||||||
|
* @return true or false.
|
||||||
|
*/
|
||||||
|
public boolean isOccupied(Color color) {
|
||||||
|
return this.occupant != null && this.occupant.getColor() == color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user