Class Cloud

java.lang.Object
it.polimi.ingsw.Model.Cloud
All Implemented Interfaces:
Serializable

public class Cloud extends Object implements Serializable
The Cloud class is used to replenish pawns in the entrance fields of the PlayerBoard.getEntranceStudents()
See Also:
  • Field Details

  • Constructor Details

    • Cloud

      public Cloud(int id)
      Construct a Cloud, assigning an ID to it.
      Parameters:
      id - if the cloud is in an array, the id will be the index of the array at which the cloud is located
  • Method Details

    • getId

      public int getId()
      The ID of the cloud is the index of the array in which the Cloud is stored
      Returns:
      the ID of the cloud
    • extractContents

      public List<PawnColour> extractContents() throws EmptyContainerException
      A Cloud will need to be emptied out, eventually. This method returns a List of PawnColour and empties the Cloud.
      Returns:
      a List of PawnColours that were contained in the Cloud
      Throws:
      EmptyContainerException - if the Cloud being emptied was already empty, this exception is thrown.
    • getContents

      public List<PawnColour> getContents()
      Cloud contents may be inspected without emptying the tile.
      Returns:
      an List.copyOf(Collection) of the contents of the Cloud
    • fill

      public void fill(List<PawnColour> colours) throws FullContainerException
      A cloud may need to be filled from time to time. this method is used for that
      Parameters:
      colours - a List of PawnColours to put in the Cloud tile
      Throws:
      FullContainerException - if the Cloud being filled already had some contents, this exception will be thrown