Coverage Summary for Class: IGameServer (it.polimi.ingsw.gc14.Network.RMI.Common)

Class
IGameServer


 package it.polimi.ingsw.gc14.Network.RMI.Common;
 
 import it.polimi.ingsw.gc14.ErrorType;
 
 import java.rmi.*;
 
 /**
  * Remote interface used by RMI clients to interact with the game server.
  */
 public interface IGameServer extends Remote {
 
     /**
      * Adds a player to the game and registers the callback used by the server
      * to notify the corresponding RMI client.
      *
      * @param username     the username chosen by the player.
      * @param preferredInt the desired number of players proposed by this client.
      * @param callback     the remote callback associated with the client.
      * @return {@code null} if the player joins successfully;
      *         an {@link it.polimi.ingsw.gc14.ErrorType} value describing the rejection otherwise.
      * @throws RemoteException if an RMI communication error occurs.
      */
     ErrorType joinGame(String username, int preferredInt, IClientCallback callback) throws RemoteException;
 
     /**
      * Requests to draw a tribe card from the upper tribe card list.
      *
      * @param playerUsername the username of the player performing the action.
      * @param pos            the position of the selected card.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void drawUpperTribeCard(String playerUsername, int pos) throws RemoteException;
 
     /**
      * Requests to draw a tribe card from the lower tribe card list.
      *
      * @param playerUsername the username of the player performing the action.
      * @param pos            the position of the selected card.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void drawLowerTribeCard(String playerUsername, int pos) throws RemoteException;
 
     /**
      * Requests to draw a building card from the upper building card list.
      *
      * @param playerUsername the username of the player performing the action.
      * @param pos            the position of the selected card.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void drawUpperBuildingCard(String playerUsername, int pos) throws RemoteException;
 
     /**
      * Requests to draw a building card from the lower building card list.
      *
      * @param playerUsername the username of the player performing the action.
      * @param pos            the position of the selected card.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void drawLowerBuildingCard(String playerUsername, int pos) throws RemoteException;
 
     /**
      * Requests to skip the current player's optional action.
      *
      * @param playerUsername the username of the player skipping the action.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void skipTurn(String playerUsername) throws RemoteException;
 
     /**
      * Requests to assign the specified player to a slot.
      *
      * @param playerUsername the username of the player making the slot choice.
      * @param pos            the position of the selected slot.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void slotChoice(String playerUsername, int pos) throws RemoteException;
 
     /**
      * Requests to assign the selected totem to the specified player.
      *
      * @param playerUsername the username of the player making the totem choice.
      * @param totems         the name of the selected totem.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void totemChoice(String playerUsername, String totems) throws RemoteException;
 
     /**
      * Heartbeat method called periodically by the client to signal
      * that it is still connected.
      *
      * <p>This method mirrors the PING/PONG mechanism used in the TCP
      * heartbeat channel.
      *
      * @param username the username of the client sending the heartbeat ping.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void ping(String username) throws RemoteException;
 
     /**
      * Notifies the server of a voluntary disconnection for the specified player.
      *
      * @param username the username of the player disconnecting.
      * @throws RemoteException if an RMI communication error occurs.
      */
     void disconnectPlayer(String username) throws RemoteException;
 }