Updated the JavaDocs in multiple classes, to improve readability.

This commit is contained in:
Daniel Grigencha
2024-12-05 05:21:33 +01:00
parent e81aa67d36
commit 3b0cd9ebdb
16 changed files with 77 additions and 37 deletions

View File

@@ -17,7 +17,7 @@ public class DieMessage extends ServerMessage {
/** /**
* Constructor for Dice * Constructor for Dice
* *
* @param diceEye the eye of the dice * @param diceEye the eye of the dice
*/ */
public DieMessage(int diceEye) { public DieMessage(int diceEye) {
super(); super();

View File

@@ -15,6 +15,7 @@ public class IncorrectRequestMessage extends ServerMessage {
* @param id as the id of the error message as an Integer. * @param id as the id of the error message as an Integer.
*/ */
public IncorrectRequestMessage(int id) { public IncorrectRequestMessage(int id) {
super();
this.id = id; this.id = id;
} }
@@ -22,6 +23,7 @@ public IncorrectRequestMessage(int id) {
* Constructor. * Constructor.
*/ */
public IncorrectRequestMessage() { public IncorrectRequestMessage() {
super();
this.id = 0; this.id = 0;
} }

View File

@@ -42,6 +42,7 @@ public LobbyPlayerJoinedMessage(int id, Player player, boolean host) {
* Default constructor for serialization purposes. * Default constructor for serialization purposes.
*/ */
private LobbyPlayerJoinedMessage() { private LobbyPlayerJoinedMessage() {
super();
player = null; player = null;
id = 0; id = 0;
host = false; host = false;
@@ -61,7 +62,7 @@ public Player getPlayer() {
* *
* @return the id of the player * @return the id of the player
*/ */
public int getId(){ public int getId() {
return id; return id;
} }

View File

@@ -16,7 +16,7 @@ public class LobbyPlayerLeaveMessage extends ServerMessage {
/** /**
* Constructs a new LobbyPlayerLeave instance with the specified player name and color. * Constructs a new LobbyPlayerLeave instance with the specified player name and color.
* *
* @param id the id of the player leaving the lobby. * @param id the id of the player leaving the lobby.
*/ */
public LobbyPlayerLeaveMessage(int id) { public LobbyPlayerLeaveMessage(int id) {
super(); super();
@@ -27,6 +27,7 @@ public LobbyPlayerLeaveMessage(int id) {
* Default constructor for serialization purposes. * Default constructor for serialization purposes.
*/ */
private LobbyPlayerLeaveMessage() { private LobbyPlayerLeaveMessage() {
super();
id = 0; id = 0;
} }

View File

@@ -40,6 +40,7 @@ public MoveMessage(UUID identifier, boolean isHomeMove, int targetIndex) {
* Default constructor for serialization purposes. * Default constructor for serialization purposes.
*/ */
private MoveMessage() { private MoveMessage() {
super();
pieceUUID = null; pieceUUID = null;
targetIndex = 0; targetIndex = 0;
isHomeMove = false; isHomeMove = false;
@@ -59,7 +60,7 @@ public UUID getIdentifier() {
* *
* @return the target index * @return the target index
*/ */
public int getTargetIndex(){ public int getTargetIndex() {
return targetIndex; return targetIndex;
} }
@@ -68,7 +69,7 @@ public int getTargetIndex(){
* *
* @return the boolean isHomeMove. * @return the boolean isHomeMove.
*/ */
public boolean isHomeMove(){ public boolean isHomeMove() {
return isHomeMove; return isHomeMove;
} }

View File

@@ -7,7 +7,6 @@
*/ */
@Serializable @Serializable
public class PauseGameMessage extends ServerMessage { public class PauseGameMessage extends ServerMessage {
/** /**
* the id of the player who has disconnected * the id of the player who has disconnected
*/ */

View File

@@ -20,15 +20,21 @@ public class PlayCardMessage extends ServerMessage {
*/ */
private final UUID ownPieceID; private final UUID ownPieceID;
/**
* The identifier of the enemy piece that should be moved.
*/
private final UUID enemyPieceID; private final UUID enemyPieceID;
/**
* The modifier of the dice.
*/
private final int diceModifier; private final int diceModifier;
/** /**
* Constructs a new PlayCard message. * Constructs a new PlayCard message.
* *
* @param card the card that should be played * @param card the card that should be played
* @param ownPieceID the identifier of the piece that should be moved * @param ownPieceID the identifier of the piece that should be moved
* @param enemyPieceID the identifier of the enemy piece that should be moved * @param enemyPieceID the identifier of the enemy piece that should be moved
* @param diceModifier the new modifier of the dice * @param diceModifier the new modifier of the dice
*/ */
@@ -53,7 +59,7 @@ private PlayCardMessage() {
/** /**
* Creates a new PlayCard message for the given card and piece identifier. * Creates a new PlayCard message for the given card and piece identifier.
* *
* @param ownPieceID the identifier of the piece of the player that should be affected * @param ownPieceID the identifier of the piece of the player that should be affected
* @param enemyPieceID the identifier of the enemy piece that should be affected * @param enemyPieceID the identifier of the enemy piece that should be affected
* @return a new PlayCard message * @return a new PlayCard message
*/ */
@@ -77,7 +83,7 @@ public static PlayCardMessage shield(UUID ownPieceID) {
* @param diceModifier the new modifier of the dice * @param diceModifier the new modifier of the dice
* @return newly constructed message * @return newly constructed message
*/ */
public static PlayCardMessage turbo(int diceModifier){ public static PlayCardMessage turbo(int diceModifier) {
return new PlayCardMessage(BonusCard.TURBO, null, null, diceModifier); return new PlayCardMessage(BonusCard.TURBO, null, null, diceModifier);
} }
@@ -114,7 +120,7 @@ public UUID getPieceIdentifierEnemy() {
* *
* @return the dice modifier as int * @return the dice modifier as int
*/ */
public int getDiceModifier(){ public int getDiceModifier() {
return diceModifier; return diceModifier;
} }

View File

@@ -5,21 +5,35 @@
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
/**
* A message sent by the server to the active player to select a piece to move.
*/
@Serializable @Serializable
public class SelectPieceMessage extends ServerMessage{ public class SelectPieceMessage extends ServerMessage {
/**
* The list of pieces
*/
private final List<UUID> pieces; private final List<UUID> pieces;
/**
* The list of booleans of isHomeMove of the pieces
*/
private final List<Boolean> isHomeMove; private final List<Boolean> isHomeMove;
/**
* The list of indexes of target nodes of the pieces
*/
private final List<Integer> targetIndex; private final List<Integer> targetIndex;
/** /**
* Constructs a new SelectPiece instance. * Constructs a new SelectPiece instance.
* *
* @param pieces the pieces to be selected * @param pieces the pieces to be selected
* @param isHomeMove the List of booleans of isHomeMove of the pieces * @param isHomeMove the List of booleans of isHomeMove of the pieces
* @param targetIndex the List of indexes of target nodes of the pieces * @param targetIndex the List of indexes of target nodes of the pieces
*/ */
public SelectPieceMessage(List<UUID> pieces, List<Boolean> isHomeMove, List<Integer> targetIndex){ public SelectPieceMessage(List<UUID> pieces, List<Boolean> isHomeMove, List<Integer> targetIndex) {
super();
this.pieces = pieces; this.pieces = pieces;
this.isHomeMove = isHomeMove; this.isHomeMove = isHomeMove;
this.targetIndex = targetIndex; this.targetIndex = targetIndex;
@@ -28,7 +42,8 @@ public SelectPieceMessage(List<UUID> pieces, List<Boolean> isHomeMove, List<Inte
/** /**
* Default constructor for serialization purposes. * Default constructor for serialization purposes.
*/ */
public SelectPieceMessage(){ public SelectPieceMessage() {
super();
pieces = null; pieces = null;
isHomeMove = null; isHomeMove = null;
targetIndex = null; targetIndex = null;
@@ -39,7 +54,7 @@ public SelectPieceMessage(){
* *
* @return the pieces * @return the pieces
*/ */
public List<UUID> getPieces(){ public List<UUID> getPieces() {
return pieces; return pieces;
} }
@@ -48,7 +63,7 @@ public List<UUID> getPieces(){
* *
* @return List of boolean values * @return List of boolean values
*/ */
public List<Boolean> getIsHomeMove(){ public List<Boolean> getIsHomeMove() {
return isHomeMove; return isHomeMove;
} }
@@ -57,7 +72,7 @@ public List<Boolean> getIsHomeMove(){
* *
* @return List of integers * @return List of integers
*/ */
public List<Integer> getTargetIndex(){ public List<Integer> getTargetIndex() {
return targetIndex; return targetIndex;
} }

View File

@@ -36,7 +36,7 @@ public interface ServerInterpreter {
/** /**
* Handles a Die message received from the server. * Handles a Die message received from the server.
* *
* @param msg the Dice message received * @param msg the Die message received
*/ */
void received(DieMessage msg); void received(DieMessage msg);
@@ -55,16 +55,16 @@ public interface ServerInterpreter {
void received(DiceNowMessage msg); void received(DiceNowMessage msg);
/** /**
* Handles an EndOfGame message received from the server. * Handles an EndOfTurn message received from the server.
* *
* @param msg the EndOfGame message received * @param msg the EndOfTurn message received
*/ */
void received(EndOfTurnMessage msg); void received(EndOfTurnMessage msg);
/** /**
* Handles a GameOver message received from the server. * Handles a LobbyAccept message received from the server.
* *
* @param msg the GameOver message received * @param msg the LobbyAccept message received
*/ */
void received(LobbyAcceptMessage msg); void received(LobbyAcceptMessage msg);
@@ -132,9 +132,9 @@ public interface ServerInterpreter {
void received(PossiblePieceMessage msg); void received(PossiblePieceMessage msg);
/** /**
* Handles a RankingResponce message received from the server. * Handles a RankingResponse message received from the server.
* *
* @param msg the RankingResponce message received * @param msg the RankingResponse message received
*/ */
void received(RankingResponseMessage msg); void received(RankingResponseMessage msg);
@@ -209,9 +209,9 @@ public interface ServerInterpreter {
void received(SelectPieceMessage msg); void received(SelectPieceMessage msg);
/** /**
* Handles a SelectTSK message received from the server. * Handles a Shutdown message received from the server.
* *
* @param msg the SelectTSK message received. * @param msg the Shutdown message received.
*/ */
void received(ShutdownMessage msg); void received(ShutdownMessage msg);

View File

@@ -13,9 +13,13 @@
@Serializable @Serializable
public class ServerStartGameMessage extends ServerMessage { public class ServerStartGameMessage extends ServerMessage {
/** /**
* Create ServerStartGameMessage attributes. * The list of players.
*/ */
private final List<Player> players; private final List<Player> players;
/**
* The board of the game.
*/
private final Board board; private final Board board;
/** /**

View File

@@ -7,6 +7,13 @@
*/ */
@Serializable @Serializable
public class ShutdownMessage extends ServerMessage { public class ShutdownMessage extends ServerMessage {
/**
* Constructs a new Shutdown message.
*/
public ShutdownMessage() {
super();
}
/** /**
* Accepts a visitor to process this message. * Accepts a visitor to process this message.
* *

View File

@@ -1,7 +1,7 @@
package pp.mdga.message.server; package pp.mdga.message.server;
/** /**
* * A message sent by the server to indicate that the client is now a spectator.
*/ */
public class SpectatorMessage extends ServerMessage { public class SpectatorMessage extends ServerMessage {
/** /**
@@ -12,7 +12,6 @@ public SpectatorMessage() {
} }
/** /**
*
* @param interpreter the visitor to process this message * @param interpreter the visitor to process this message
*/ */
@Override @Override

View File

@@ -23,7 +23,7 @@ public class StartPieceMessage extends ServerMessage {
* Constructs a new StartPiece instance with the specified piece identifier. * Constructs a new StartPiece instance with the specified piece identifier.
* *
* @param pieceIdentifier the identifier for the piece * @param pieceIdentifier the identifier for the piece
* @param targetIndex the index of the targetNode * @param targetIndex the index of the targetNode
*/ */
public StartPieceMessage(UUID pieceIdentifier, int targetIndex) { public StartPieceMessage(UUID pieceIdentifier, int targetIndex) {
super(); super();
@@ -54,7 +54,7 @@ public UUID getPieceIdentifier() {
* *
* @return the index of the target node as int. * @return the index of the target node as int.
*/ */
public int getTargetIndex(){ public int getTargetIndex() {
return targetIndex; return targetIndex;
} }

View File

@@ -21,7 +21,7 @@ public class UpdateReadyMessage extends ServerMessage {
* Constructs a new UpdateReady instance with the specified color and readiness status. * Constructs a new UpdateReady instance with the specified color and readiness status.
* *
* @param playerId the playerId associated with the update * @param playerId the playerId associated with the update
* @param ready the readiness status * @param ready the readiness status
*/ */
public UpdateReadyMessage(int playerId, boolean ready) { public UpdateReadyMessage(int playerId, boolean ready) {
super(); super();

View File

@@ -18,12 +18,15 @@ public class UpdateTSKMessage extends ServerMessage {
*/ */
private final Color color; private final Color color;
/**
* The flag if the TSK is taken.
*/
private final boolean isTaken; private final boolean isTaken;
/** /**
* Constructs a new UpdateTSK instance with the specified id and color. * Constructs a new UpdateTSK instance with the specified id and color.
* *
* @param id the name associated with the update * @param id the name associated with the update
* @param color the color associated with the update * @param color the color associated with the update
*/ */
public UpdateTSKMessage(int id, Color color, boolean isTaken) { public UpdateTSKMessage(int id, Color color, boolean isTaken) {

View File

@@ -9,7 +9,9 @@
*/ */
@Serializable @Serializable
public class WaitPieceMessage extends ServerMessage { public class WaitPieceMessage extends ServerMessage {
/**
* The pieceID of the piece to choose.
*/
private final UUID pieceID; private final UUID pieceID;
/** /**