Files
Gruppe-01-fin/Projekte/mdga/model/src/main/java/pp.mdga/game/Node.java
2024-11-12 17:26:10 +01:00

48 lines
1.1 KiB
Java

package pp.mdga.game;
/**
* This class will be used the represent a Node on which the pieces can travel along
*/
public class Node {
protected Piece occupant;
public Node() {}
/**
* This method is used to get an occupant of the Node.
*
* @return the current occupant of the node
*/
public Piece getOccupant() {
return occupant;
}
/**
* This method is used to set a new Occupant
*
* @param occupant the new occupant of the node
*/
public void setOccupant(Piece occupant) {
if (occupant.isSuppressed()){
occupant.setShield(ShieldState.NONE);
}
this.occupant = occupant;
}
/**
* This method is used to clear the node of its occupant
*/
public void clearOccupant() {
this.occupant = null;
}
/**
* This method is used to return a boolean value based on the occupation status
*
* @return the boolean value corresponding to the occupation status
*/
public boolean isOccupied() {
return occupant != null;
}
}