Add: JavaDoc for Game getters and fields
This commit is contained in:
@@ -18,41 +18,107 @@ import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* Represents the main game model.
|
||||
* A Game object stores the players, the current state of the match,
|
||||
* the slot assignments, the board, and the logic required to manage the game flow.
|
||||
*/
|
||||
public class Game implements Serializable {
|
||||
|
||||
/**
|
||||
* The list of players participating in the game.
|
||||
*/
|
||||
private ArrayList<Player> playersList;
|
||||
|
||||
/**
|
||||
* The current state of the game.
|
||||
*/
|
||||
private CurrentState currentState;
|
||||
|
||||
/**
|
||||
* The mapping between slots and the players assigned to them.
|
||||
*/
|
||||
private HashMap<Slot,Player> slotMap;
|
||||
|
||||
/**
|
||||
* The configured number of players for this game.
|
||||
*/
|
||||
private int nPlayers;
|
||||
|
||||
/**
|
||||
* The queue of players involved in optional card resolution.
|
||||
*/
|
||||
private Queue<Player> OptionalCardQueue;
|
||||
|
||||
/**
|
||||
* The order logic card associated with this game.
|
||||
*/
|
||||
private OrderLogicCard orderLogicCard;
|
||||
|
||||
/**
|
||||
* The board associated with this game.
|
||||
*/
|
||||
private Board board;
|
||||
|
||||
|
||||
/**
|
||||
* Returns clones of the upper tribe cards currently available on the board.
|
||||
*
|
||||
* @return a list containing clones of the upper tribe cards currently available on the board.
|
||||
*/
|
||||
public List<TribeCard>getUpperListTribeCards() {
|
||||
List<TribeCard> cards = new ArrayList<>();
|
||||
board.upperListTribe.forEach(x->cards.add(x.clone()));
|
||||
return cards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns clones of the lower tribe cards currently available on the board.
|
||||
*
|
||||
* @return a list containing clones of the lower tribe cards currently available on the board.
|
||||
*/
|
||||
public List<TribeCard>getLowerListTribeCards() {
|
||||
List<TribeCard> cards = new ArrayList<>();
|
||||
board.lowerListTribe.forEach(x->cards.add(x.clone()));
|
||||
return cards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns clones of the upper building cards currently available on the board.
|
||||
*
|
||||
* @return a list containing clones of the upper building cards currently available on the board.
|
||||
*/
|
||||
public List<BuildingCard>getUpperListBuilding() {
|
||||
List<BuildingCard> cards = new ArrayList<>();
|
||||
board.upperListBuilding.forEach(x->cards.add(x.clone()));
|
||||
return cards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns clones of the lower building cards currently available on the board.
|
||||
*
|
||||
* @return a list containing clones of the lower building cards currently available on the board.
|
||||
*/
|
||||
public List<BuildingCard>getLowerListBuilding() {
|
||||
List<BuildingCard> cards = new ArrayList<>();
|
||||
board.lowerListBuilding.forEach(x->cards.add(x.clone()));
|
||||
return cards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current state of the game.
|
||||
*
|
||||
* @return the current state of the game.
|
||||
*/
|
||||
public CurrentState getCurrentState() {
|
||||
return currentState;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the player with the specified username, if present.
|
||||
*
|
||||
* @param Username the username of the player to search for.
|
||||
* @return the player with the specified username, or {@code null} if no such player exists.
|
||||
*/
|
||||
public Player getPlayerByUsername(String Username) throws IndexOutOfBoundsException {
|
||||
return playersList.stream().filter(x->x.getUserName().equals(Username)).findFirst().orElse(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user