Class SchoolBoard

java.lang.Object
it.polimi.ingsw.eriantys.model.SchoolBoard

public class SchoolBoard extends Object
This class models a Player's school board: it contains an entrance and a dining room (both StudentContainers) and an integer representing the number of towers it contains. It exposes methods to get and put towers from and into the board and a method to check if the Player who owns the board should receive a coin based on the students it contains.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SchoolBoard(int entranceSize, int towerNumber)
    Constructs a SchoolBoard initially containing the maximum number of towers, with an empty entrance of maximum size according to the game rules and an empty diningRoom.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if and only if the Player who owns this SchoolBoard is entitled to receive a coin based on the number of students of color color their DiningRoom contains.
    boolean
    If this SchoolBoard has at least one tower prior to this method's invocation, decreases the number of towers by 1 and returns true, otherwise returns false.
    A getter for the object's dining room.
    A getter for the object's entrance.
    int
    A helper-getter method to fulfill the BoardStatus creation process.
    boolean
    If this SchoolBoard has less than the maximum number of towers prior to this method's invocation, increases the number of towers by 1 and returns true, otherwise returns false.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SchoolBoard

      public SchoolBoard(int entranceSize, int towerNumber)
      Constructs a SchoolBoard initially containing the maximum number of towers, with an empty entrance of maximum size according to the game rules and an empty diningRoom.
      Parameters:
      entranceSize - the maximum number of students which the entrance can hold
      towerNumber - the maximum number of towers which the schoolboard can hold
  • Method Details

    • getEntrance

      public StudentContainer getEntrance()
      A getter for the object's entrance.
      Returns:
      this SchoolBoard's entrance
    • getDiningRoom

      public DiningRoom getDiningRoom()
      A getter for the object's dining room.
      Returns:
      this SchoolBoard's dining room
    • checkForCoins

      public boolean checkForCoins(Color color)
      Returns true if and only if the Player who owns this SchoolBoard is entitled to receive a coin based on the number of students of color color their DiningRoom contains.
      Parameters:
      color - the Color whose amount of students is checked
      Returns:
      true if and only if the Player who owns this DiningRoom is entitled to receive a coin based on the number of students of color color their DiningRoom contains
    • deployTower

      public boolean deployTower()
      If this SchoolBoard has at least one tower prior to this method's invocation, decreases the number of towers by 1 and returns true, otherwise returns false.
      Returns:
      true if and only if this SchoolBoard can deploy an additional tower
    • returnTower

      public boolean returnTower()
      If this SchoolBoard has less than the maximum number of towers prior to this method's invocation, increases the number of towers by 1 and returns true, otherwise returns false.
      Returns:
      true if and only if this SchoolBoard can contain an additional tower
    • getTowerQuantity

      public int getTowerQuantity()
      A helper-getter method to fulfill the BoardStatus creation process.
      Returns:
      a representation for the number of towers owned by the Player