diff --git a/src/baleine/common/interfaces/server/IComToData.java b/src/baleine/common/interfaces/server/IComToData.java index cbcb86463bc20a1ea7ee1ef30c23911b9bf5fbe1..9d53b4c524ae53cdb64cdc2f8f24d50764a97835 100644 --- a/src/baleine/common/interfaces/server/IComToData.java +++ b/src/baleine/common/interfaces/server/IComToData.java @@ -10,23 +10,78 @@ import baleine.common.dataModel.Message; import baleine.common.dataModel.Move; import baleine.common.dataModel.UserLight; +/** + * IComToData This class is an interface which provides server methods to + * communicate from Com to Data modules. + */ public interface IComToData { - - public void requestPlayerByUUID(UUID playerID); - public void addNewUser(UserLight userLight); + /** + * Requests a player by its UUID. + * + * @param playerID : the UUID of the player to retrieve + */ + public void requestPlayerByUUID(UUID playerID); - public void createGame(GameLight gameLight); + /** + * Adds a new user to the list. + * + * @param userLight : the user to add + */ + public void addNewUser(UserLight userLight); - public void requestGameSave(UUID gameID); + /** + * Create a new game. + * + * @param gameLight : the game to create + */ + public void createGame(GameLight gameLight); - public Message receiveNewChatMessage(String message, Timestamp timestamp, UUID userID, UUID gameID); + /** + * Request saving a game by UUID. + * + * @param gameID : the UUID of the game to save + */ + public void requestGameSave(UUID gameID); - public ArrayList<UUID> getAllGameParticipants (UUID gameID); + /** + * Receive a new chat message to transfer it. + * + * @param message : the message to transfer + * @param timestamp : the timestamp of the message + * @param userID : the UUID of the user sending the message + * @param gameID : the UUID of the game in which the message was sent + * @return the message to transfer + */ + public Message receiveNewChatMessage(String message, Timestamp timestamp, UUID userID, UUID gameID); - public void disconnectUser(UUID userID); + /** + * Get all the participants (players & spectators) of a game. + * + * @param gameID : the UUID of the game + * @return the list of users + */ + public ArrayList<UUID> getAllGameParticipants(UUID gameID); - public void addSpectator(GameLight gameLight, UserLight userLight); + /** + * Notifies that a user has been disconnected. + * + * @param userID : the UUID of the disconnected user + */ + public void disconnectUser(UUID userID); - public void sendMove(Move move); + /** + * Adds a spectator to a game. + * + * @param gameLight : the game concerned + * @param userLight : the user to add as spectator + */ + public void addSpectator(GameLight gameLight, UserLight userLight); + + /** + * Send a move to the data module. + * + * @param move : the move to send + */ + public void sendMove(Move move); } \ No newline at end of file diff --git a/src/baleine/common/interfaces/server/IDataToCom.java b/src/baleine/common/interfaces/server/IDataToCom.java index 0b7b65da0b274d209c25f5656193aad6043e0397..d0979f40d2948e51ee23a45cec7e7e8b6e30bef9 100644 --- a/src/baleine/common/interfaces/server/IDataToCom.java +++ b/src/baleine/common/interfaces/server/IDataToCom.java @@ -6,11 +6,34 @@ import baleine.common.dataModel.Board; import baleine.common.dataModel.GameLight; import baleine.common.dataModel.UserLight; +/** + * IDataToCom This class is an interface which provides server methods to + * communicate from Data to Com modules. + */ public interface IDataToCom { - + + /** + * Notifies that a new game has been created. + * + * @param newGameCreated : the new game created + */ public void notifyNewGame(GameLight newGameCreated); - + + /** + * Sends a move update message to the different users of a game. + * + * @param players : the players of the game + * @param spectators : the spectators of the game + * @param updateBoard : the board to update + */ public void sendUpdateMoveMessage(ArrayList<UserLight> players, ArrayList<UserLight> spectators, Board updateBoard); - + + /** + * Sends an end message to the different users of a game. + * + * @param players : the players of the game + * @param spectators : the spectators of the game + * @param updateBoard : the board to update + */ public void sendEndMoveMessage(ArrayList<UserLight> players, ArrayList<UserLight> spectators, Board updateBoard); }