Class SchoolBoard
java.lang.Object
it.polimi.ingsw.server.model.game_logic.SchoolBoard
- All Implemented Interfaces:
SchoolBoardCommonInterface
- Direct Known Subclasses:
ExpertSchoolBoard
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionSchoolBoard(int id, List<Color> studentsInTheEntrance, TowerColor towerColor) privateSchoolBoard(int id, Map<Color, Integer> diningRoomLaneColorToNumberOfStudents, TowerColor towerColor, List<Color> studentsInTheEntrance, Set<Color> professorsTable, List<Card> deck) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProfessor(Color professor) This method adds a professor to the schoolBoardprotected voidaddStudentToDiningRoom(Color student) This method adds the inputted student to the diningRoomvoidaddStudentToEntrance(Color student) This method adds the inputted student to the entrancebooleancontainsAllStudentsInTheDiningRoom(List<Color> students) This method checks if the inputted list of students is a subList of the students in the diningRoombooleancontainsAllStudentsInTheEntrance(List<Color> students) This method checks if the inputted list of students is a subList of the students in the entrancegetDeck()Returns the deck made up by the remaining assistant cards yet to be playedThis method returns a map that links every diningRoom lane to the number of students that are in itintgetId()This method returns the ID associated with the schoolBoardThis method returns the set of professors that are controlled by the schoolBoardReturns the list of students that are in the entrance of the schoolBoardThis method returns the tower color of the schoolBoardvoidgrabStudentsFromCloud(List<Color> studentsGrabbed) Students are put in the entrancebooleanisInTheEntrance(Color student) lightify()This method returns the light version of the schoolBoard, containing all the useful information that need to be sent over the networkvoidmoveFromEntranceToDiningRoom(Color student) voidThis method receives an argument of type Card and proceeds removing the corresponding card from the player's deck of playable cards.voidremoveProfessor(Color professor) This method removes a professor from the schoolBoardvoidremoveStudentFromEntrance(Color student) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.polimi.ingsw.server.model.game_logic.SchoolBoardCommonInterface
getCoins, payCharacter, removeStudentFromDiningRoom
-
Field Details
-
id
protected final int id -
diningRoomLaneColorToNumberOfStudents
-
towerColor
-
studentsInTheEntrance
-
professorsTable
-
deck
-
-
Constructor Details
-
SchoolBoard
- Parameters:
id- must be a unique id for this schoolBoard in this gamestudentsInTheEntrance- students to put in the entrance of the schoolBoardtowerColor- tower color of this schoolBoard- Throws:
IllegalArgumentException- if studentsInTheEntrance == null or studentsInTheEntrance contains null
-
SchoolBoard
-
-
Method Details
-
playCard
This method receives an argument of type Card and proceeds removing the corresponding card from the player's deck of playable cards.- Parameters:
card- the card to be played, and hence removed from the deck- Throws:
IllegalArgumentException- if(card == null)CardIsNotInTheDeckException- if the card is not contained in the deck if(!this.deck.contains(card))
-
getId
public int getId()This method returns the ID associated with the schoolBoard- Returns:
- an int representing the ID of the schoolBoard
-
isInTheEntrance
- Returns:
- true if at least a student of the given color is in the entrance of the school board, false otherwise
- Throws:
IllegalArgumentException- if(student == null)
-
moveFromEntranceToDiningRoom
public void moveFromEntranceToDiningRoom(Color student) throws StudentNotInTheEntranceException, FullDiningRoomLaneException - Throws:
IllegalArgumentException- if(student == null)StudentNotInTheEntranceException- if the student is not in the entranceFullDiningRoomLaneException- if the diningRoomLane is full
-
addStudentToDiningRoom
This method adds the inputted student to the diningRoom- Parameters:
student- is the student that will be added to the diningRoom- Throws:
FullDiningRoomLaneException- if the diningRoom table corresponding to the inputted student is already full
-
removeStudentFromEntrance
- Throws:
IllegalArgumentException- if(student == null)StudentNotInTheEntranceException- if the student is not contained in the list representing the students in the entrance
-
addStudentToEntrance
This method adds the inputted student to the entrance- Parameters:
student- is the student that will be added to the entrance
-
containsAllStudentsInTheEntrance
This method checks if the inputted list of students is a subList of the students in the entrance- Parameters:
students- is the list of students that have to be checked- Returns:
- true if all the elements of the inputted list are contained in the entrance (counting duplicates), false otherwise
-
containsAllStudentsInTheDiningRoom
This method checks if the inputted list of students is a subList of the students in the diningRoom- Parameters:
students- is the list of students that have to be checked- Returns:
- true if all the elements of the inputted list are contained in the diningRoom (counting duplicates), false otherwise
-
grabStudentsFromCloud
Students are put in the entrance- Parameters:
studentsGrabbed- students grabbed from the cloud- Throws:
IllegalArgumentException- if(studentsGrabbed == null or studentsGrabbed contains null)
-
getProfessors
This method returns the set of professors that are controlled by the schoolBoard- Returns:
- a set containing all the professors controlled by the schoolBoard
-
getTowerColor
This method returns the tower color of the schoolBoard- Returns:
- the TowerColor of the schoolBoard
-
getDeck
Returns the deck made up by the remaining assistant cards yet to be played- Returns:
- a list made up by the remaining assistant cards yet to be played
-
getStudentsInTheEntrance
Returns the list of students that are in the entrance of the schoolBoard- Returns:
- the list of students that are in the entrance of the schoolBoard
-
addProfessor
This method adds a professor to the schoolBoard- Parameters:
professor- is the color representing the professor that has to be added to the schoolBoard
-
removeProfessor
This method removes a professor from the schoolBoard- Parameters:
professor- is the color representing the professor that has to be removed
-
getDiningRoomLaneColorToNumberOfStudents
This method returns a map that links every diningRoom lane to the number of students that are in it- Returns:
- a map that links every diningRoom lane to the number of students that are in it
-
lightify
This method returns the light version of the schoolBoard, containing all the useful information that need to be sent over the network- Returns:
- the light version of the schoolBoard, containing all the useful information that need to be sent over the network
-