From bb51976127a7ba6923eff0fe71d6db1b7a63e8b0 Mon Sep 17 00:00:00 2001 From: Daniel Grigencha Date: Tue, 3 Dec 2024 04:57:30 +0100 Subject: [PATCH] Updated 'Node' class. Updated the 'Node' class by overload the 'isOccupied' method in it. --- .../mdga/model/src/main/java/pp/mdga/game/Node.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java b/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java index de6530ca..837dd3a6 100644 --- a/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java +++ b/Projekte/mdga/model/src/main/java/pp/mdga/game/Node.java @@ -49,4 +49,14 @@ public void clearOccupant() { public boolean isOccupied() { 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; + } }