Skip to content

Commit

Permalink
JavaDoc n1
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-confalonieri committed Jun 16, 2022
1 parent 11021f4 commit 6f56c65
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/main/java/it/polimi/ingsw/action/MoveStudentsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public List<Student> getToDiningRoom() {
return toDiningRoom;
}

/**
* Returns a map by merging the information from the list studentsToIsland and IslandsUUID
* @return The map containing students and their destinations (islands)
* @author Christian Confalonieri
*/
public Map<Student, String> getToIsland() {
Map<Student,String> toIsland = new HashMap<>();
for(int i=0; i<studentsToIsland.size(); i++) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/it/polimi/ingsw/cli/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void printHelp(String[] command) {
}

/**
* It simply calls the method with the same name as the InputCLI class as long as it is not invoked shutdown
* @author Christian Confalonieri
*/
public void inputHandler() {
Expand All @@ -77,6 +78,7 @@ public void inputHandler() {
}

/**
* For each client status it cleans the screen and prints the updated information
* @author Christian Confalonieri
*/
public void render() {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/it/polimi/ingsw/cli/CLIRenderHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ public void printPowers() {


/**
* Prints character-related command help, if it is invoked before creating a game all characters are printed,
* otherwise only those in the current game
* @author Christian Confalonieri
*/
private void printPowersHelp() {
Expand Down Expand Up @@ -533,6 +535,7 @@ private void printPowersHelp() {
}

/**
* Print help for commands related to the main menu
* @author Christian Confalonieri
*/
private void printMainMenuHelp() {
Expand All @@ -551,6 +554,7 @@ private void printMainMenuHelp() {
}

/**
* Print help for commands related to the waiting lobby
* @author Christian Confalonieri
*/
private void printWaitingLobbyHelp() {
Expand All @@ -559,6 +563,7 @@ private void printWaitingLobbyHelp() {
}

/**
* Print help for commands related to moving student client state
* @author Christian Confalonieri
*/
private void printMoveStudentsHelp() {
Expand All @@ -571,6 +576,8 @@ private void printMoveStudentsHelp() {
}

/**
* Print help related to keywords used for command invocation
* @param command The command entered by the user
* @author Christian Confalonieri
*/
private void printKeyWordsHelp(String[] command) {
Expand Down Expand Up @@ -626,6 +633,8 @@ private void printKeyWordsHelp(String[] command) {
}

/**
* Printing generic help for using the commands
* @param command The command entered by the user
* @author Christian Confalonieri
*/
public void printHelp(String[] command) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

public class GameService {
/**
* Method that plays the card on the client model and advances the state
* @param action The action received from the server
* @author Christian Confalonieri
*/
public static void playCard(PlayCardAction action) {
Expand All @@ -31,6 +33,8 @@ public static void playCard(PlayCardAction action) {
}

/**
* Method that sends the request to the server in order to play the card
* @param card The card to be played on the client model
* @author Christian Confalonieri
*/
public static void playCardRequest(Card card) {
Expand All @@ -39,6 +43,8 @@ public static void playCardRequest(Card card) {
}

/**
* Print the error message on the screen
* @param failedAck The ack of action failure
* @author Christian Confalonieri
*/
public static void failedPlayCard(ACK failedAck) {
Expand All @@ -47,6 +53,8 @@ public static void failedPlayCard(ACK failedAck) {
}

/**
* Method that move students on the client model and advances the state
* @param action The action received from the server
* @author Christian Confalonieri
*/
public static void moveStudents(MoveStudentsAction action) {
Expand All @@ -73,6 +81,9 @@ public static void moveStudents(MoveStudentsAction action) {
}

/**
* Method that sends the request to the server in order to move students
* @param toDiningRoom Students to be moved to the dining room
* @param toIslands Students to be moved to the islands
* @author Christian Confalonieri
*/
public static void moveStudentsRequest(List<Student> toDiningRoom, Map<Student,String> toIslands) {
Expand All @@ -81,6 +92,8 @@ public static void moveStudentsRequest(List<Student> toDiningRoom, Map<Student,S
}

/**
* Print the error message on the screen
* @param failedAck The ack of action failure
* @author Christian Confalonieri
*/
public static void failedMoveStudents(ACK failedAck) {
Expand All @@ -89,6 +102,8 @@ public static void failedMoveStudents(ACK failedAck) {
}

/**
* Method that move Mother Nature on the client model and advances the state
* @param action The action received from the server
* @author Christian Confalonieri
*/
public static void moveMotherNature(MoveMotherNatureAction action) {
Expand All @@ -110,6 +125,8 @@ public static void moveMotherNature(MoveMotherNatureAction action) {
}

/**
* Method that sends the request to the server in order to move Mother Nature
* @param steps Steps to be taken by mother nature
* @author Christian Confalonieri
*/
public static void moveMotherNatureRequest(int steps) {
Expand All @@ -118,6 +135,8 @@ public static void moveMotherNatureRequest(int steps) {
}

/**
* Print the error message on the screen
* @param failedAck The ack of action failure
* @author Christian Confalonieri
*/
public static void failedMoveMotherNature(ACK failedAck) {
Expand All @@ -126,6 +145,8 @@ public static void failedMoveMotherNature(ACK failedAck) {
}

/**
* Method that moves cloud students on the client model and advances the state
* @param action The action received from the server
* @author Christian Confalonieri
*/
public static void moveCloud(MoveCloudAction action){
Expand All @@ -140,6 +161,8 @@ public static void moveCloud(MoveCloudAction action){
}

/**
* Method that sends the request to the server in order to move the cloud students
* @param cloud The chosen cloud
* @author Christian Confalonieri
*/
public static void moveCloudRequest(Cloud cloud){
Expand All @@ -148,6 +171,8 @@ public static void moveCloudRequest(Cloud cloud){
}

/**
* Print the error message on the screen
* @param failedAck The ack of action failure
* @author Christian Confalonieri
*/
public static void failedMoveCloud(ACK failedAck) {
Expand All @@ -156,6 +181,8 @@ public static void failedMoveCloud(ACK failedAck) {
}

/**
* Method that activates the chosen character on the client model and advances the state
* @param action The action received from the server
* @author Christian Confalonieri
*/
public static void power(PowerAction action) {
Expand All @@ -169,6 +196,8 @@ public static void power(PowerAction action) {
}

/**
* Method that sends the request to the server in order to play the chosen character
* @param effectHandler The effectHandler with the appropriately modified attributes
* @author Christian Confalonieri
*/
public static void powerRequest(PowerType type, EffectHandler effectHandler) {
Expand All @@ -177,6 +206,8 @@ public static void powerRequest(PowerType type, EffectHandler effectHandler) {
}

/**
* Print the error message on the screen
* @param failedAck The ack of action failure
* @author Christian Confalonieri
*/
public static void failedPower(ACK failedAck) {
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/it/polimi/ingsw/controller/services/GameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public static void playCard(PlayCardAction action) throws InvalidAction {
}

/**
* Method that moves students to the server model of the current game and advances the state.
* Before changing the model it does all the checks and in case it sends an ack.
* If successful (not failed ack) update all clients.
* @param action The action received from the client
* @throws InvalidAction
* @author Christian Confalonieri
*/
public static void moveStudents(MoveStudentsAction action) throws InvalidAction {
Expand Down Expand Up @@ -142,6 +147,11 @@ public static void moveStudents(MoveStudentsAction action) throws InvalidAction
}

/**
* Method that moves Mother Nature to the server model of the current game and advances the state.
* Before changing the model it does all the checks and in case it sends an ack.
* If successful (not failed ack) update all clients.
* @param action The action received from the client
* @throws InvalidAction
* @author Christian Confalonieri
*/
public static void moveMotherNature(MoveMotherNatureAction action) throws InvalidAction {
Expand Down Expand Up @@ -197,6 +207,11 @@ public static void moveMotherNature(MoveMotherNatureAction action) throws Invali
}

/**
* Method that moves cloud students to the server model of the current game and advances the state.
* Before changing the model it does all the checks and in case it sends an ack.
* If successful (not failed ack) update all clients.
* @param action The action received from the client
* @throws InvalidAction
* @author Christian Confalonieri
*/
public static void moveCloud(MoveCloudAction action) throws InvalidAction {
Expand Down Expand Up @@ -236,6 +251,11 @@ public static void moveCloud(MoveCloudAction action) throws InvalidAction {
}

/**
* Method that activates the chosen character to the server model of the current game and advances the state.
* Before changing the model it does all the checks and in case it sends an ack.
* If successful (not failed ack) update all clients.
* @param action The action received from the client
* @throws InvalidAction
* @author Christian Confalonieri
*/
public static void power(PowerAction action) throws InvalidAction {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/it/polimi/ingsw/model/entity/Cloud.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import java.util.List;

/**
* @author Christian Confalonieri, Alessandro Ettore
* @author Christian Confalonieri
*/
public class Cloud extends Entity {

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/it/polimi/ingsw/model/entity/Pawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ public Pawn(PawnColor color) {
}

/**
* Converts a color from string to PawnColor.
* @param color The color string to be converted
* @return PawnColor
* @throws InvalidColor
* @author Christian Confalonieri
*/
public static PawnColor parseColor(String color) throws InvalidColor {
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/it/polimi/ingsw/model/enumeration/Wizard.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ public enum Wizard {
BLUE, PURPLE, YELLOW, GREEN;

/**
* Converts a color from string to Wizard.
* @param color The color string to be converted
* @return Wizard
* @throws InvalidColor
* @author Christian Confalonieri
*/
public static Wizard parseColor(String color) throws InvalidColor {
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/it/polimi/ingsw/model/game/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ public List<PowerCard> getPowerCards() {
}

/**
* Converts an uuid code to the island object.
* @param uuid The code related to the island object to be returned
* @return An island object related to the uuid
* @author Christian Confalonieri
*/
public Island getIslandFromId(String uuid) {
Expand All @@ -415,6 +418,9 @@ public Island getIslandFromId(String uuid) {
}

/**
* Converts an uuid code to the cloud object.
* @param uuid The code related to the cloud object to be returned
* @return A cloud object related to the uuid
* @author Christian Confalonieri
*/
public Cloud getCloudFromId(String uuid) {
Expand All @@ -427,6 +433,9 @@ public Cloud getCloudFromId(String uuid) {
}

/**
* Converts an uuid code to the player object.
* @param uuid The code related to the player object to be returned
* @return A player object related to the uuid
* @author Christian Confalonieri
*/
public Player getPlayerFromId(String uuid) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/it/polimi/ingsw/model/power/Mailman.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public Mailman() {
}

/**
* The method sets to true the value contained in effectHandler "mailmanActive"
* @author Christian Confalonieri
*/
@Override
Expand All @@ -36,6 +37,7 @@ public void power() {
}

/**
* The method sets to false the value contained in effectHandler "mailmanActive"
* @author Christian Confalonieri
*/
@Override
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/it/polimi/ingsw/server/GameLobby.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ synchronized public String toString() {
synchronized public String toStringNoColors() {return numberOfPlayers + "P\t" + waitingPlayersToStringNoColor() + "\t"; }

/**
* Returns a vector string containing the lobby information.
* @return A string vector containing the lobby information
* @author Christian Confalonieri
*/
synchronized public String[] toStringArrayPlayers() {
Expand Down

0 comments on commit 6f56c65

Please sign in to comment.