Fix and complete JavaDoc comments

This commit is contained in:
MatteoPellegrino05
2026-05-06 16:59:18 +02:00
parent b40ed99bc1
commit 51718699a3
35 changed files with 390 additions and 54 deletions
@@ -48,9 +48,9 @@ public class Board implements Serializable {
private int era;
/**
* Creates and returns a new list containing the slots (tiles) of the game
* Creates and returns a new list containing the slots (tiles) of the game.
*
* @return a copy of the slot list
* @return a copy of the slot list.
*/
public List<Slot> getSlotList(){
return slotList.stream().map(x->new Slot(x.getSlotId())).collect(Collectors.toList());
@@ -71,13 +71,13 @@ public class Board implements Serializable {
/**
* Creates and initializes a new board:
* - Generate the slotList using a method of DecksCreator
* - Generate the tribeDeck
* - Populate the lower list (if there is an event card, it's added to the upper list)
* - Populate the upper list
* - Generate the buildingDeck using a method of DecksCreator
* - Generate the slotList using a method of DecksCreator.
* - Generate the tribeDeck.
* - Populate the lower list (if there is an event card, it's added to the upper list).
* - Populate the upper list.
* - Generate the buildingDeck using a method of DecksCreator.
*
* @param nTotem the number of players
* @param nTotem the number of players.
*/
public Board(int nTotem) {
this.nTotem = nTotem;
@@ -120,12 +120,12 @@ public class Board implements Serializable {
* Creates the tribeDeck. Loads the cards from each era, shuffle them, and then combine them in the final deck.
* In the end, two special events (Sustenance and ShamanicRitual) are added.
*
* @param nPlayers the number of players
* @param nPlayers the number of players.
* @return a queue containing the cards in this order:
* - Era 1
* - Era 2
* - Era 3
* - Special events
* - Era 1.
* - Era 2.
* - Era 3.
* - Special events.
*/
private Queue<TribeCard> generateTribeDeck(int nPlayers) {
ArrayList<TribeCard> era1= DecksCreator.loadTribeDeckByEra(1).stream().filter(x->x.getNMin()<=nPlayers).collect(Collectors.toCollection(ArrayList::new));
@@ -150,40 +150,40 @@ public class Board implements Serializable {
}
/**
* Take the selected card from the upper tribe list of the board
* Take the selected card from the upper tribe list of the board.
*
* @param tribeCard is the card to remove
* @return true if the card is succesfully removed
* @param tribeCard is the card to remove.
* @return true if the card is succesfully removed.
*/
public boolean removeUpperTribeCard(TribeCard tribeCard) {
return upperListTribe.remove(tribeCard);
}
/**
* Take the selected card from the lower tribe list of the board
* Take the selected card from the lower tribe list of the board.
*
* @param tribeCard is the card to remove
* @return true if succeed in removing the card
* @param tribeCard is the card to remove.
* @return true if succeed in removing the card.
*/
public boolean removeLowerTribeCard(TribeCard tribeCard) {
return lowerListTribe.remove(tribeCard);
}
/**
* Take the selected card from the upper building list of the board
* Take the selected card from the upper building list of the board.
*
* @param buildingCard is the card to remove
* @return true if succeed in removing the card
* @param buildingCard is the card to remove.
* @return true if succeed in removing the card.
*/
public boolean removeUpperBuildingCard(BuildingCard buildingCard) {
return upperListBuilding.remove(buildingCard);
}
/**
* Take the selected card from the lower building list of the board
* Take the selected card from the lower building list of the board.
*
* @param buildingCard is the card to remove
* @return true if succeed in removing the card
* @param buildingCard is the card to remove.
* @return true if succeed in removing the card.
*/
public boolean removeLowerBuildingCard(BuildingCard buildingCard) {
return lowerListBuilding.remove(buildingCard);
@@ -191,10 +191,11 @@ public class Board implements Serializable {
/**
* Goes to the next round.
* - Clear the lower tribe row
* - Moves the upper tribe row to the lower one
* - Populate the upper tribe row
* - Clear the lower tribe row.
* - Moves the upper tribe row to the lower one.
* - Populate the upper tribe row.
*
* @return the current era after moving to the next round.
*/
public int nextRound() {
lowerListTribe.clear();
@@ -216,9 +217,9 @@ public class Board implements Serializable {
/**
* Changes the era of the game:
* - Increase the era attribute
* - Clear the lower building list and replace it with the upper building list
* - Repopulate the upper building list
* - Increase the era attribute.
* - Clear the lower building list and replace it with the upper building list.
* - Repopulate the upper building list.
*/
private void nextEra() {
era=era+1;
@@ -1,5 +1,10 @@
package it.polimi.ingsw.gc14.Model.GamePackage;
/**
* Represents the possible stages of a game.
/**
* Represents the possible stages of a game.
*/
public enum GameStages {
WAITING, SLOT_CHOICE, RESOLVING_ACTIONS, OPTIONAL_CARD_EFFECT, RESOLVING_EVENT, ENDING, ENDED
}