Class Bag


public class Bag extends StudentContainer
This class models the actual bag in the board game, which initially contains all the students discs. It exposes a method which returns a list of Color, used during the game setup.
See Also:
  • Constructor Details

    • Bag

      public Bag()
      Constructs an empty Bag, then fills it with 26 students for each color, 130 total.
      See Also:
  • Method Details

    • setupDraw

      public List<Color> setupDraw()
      Sets up the islands at the start of the game.
      Returns:
      a list containing two students of each Color in random order
      See Also:
    • isEmpty

      public boolean isEmpty()
      A method which states if the Bag is empty.
      Returns:
      true if and only if the object is empty
    • remainingCapacity

      protected int remainingCapacity(Color color)
      Returns the remaining capacity of the container for the specified Color, an integer between 0 and MAX_STUDENTS_PER_COLOR, or -1 if color is null.
      Overrides:
      remainingCapacity in class StudentContainer
      Parameters:
      color - the color whose remaining capacity is returned.
      Returns:
      the remaining capacity of the container for the specified Color, an integer between 0 and MAX_STUDENTS_PER_COLOR, or -1 if color is null.
      See Also:
      • StudentContainer.remainingCapacity()