Coverage Summary for Class: CompositeClientBroadcaster (it.polimi.ingsw.gc14.Network)

Class Class, % Method, % Line, %
CompositeClientBroadcaster 0% (0/1) 0% (0/3) 0% (0/7)


 package it.polimi.ingsw.gc14.Network;
 
 import it.polimi.ingsw.gc14.Model.MiniModel;
 import it.polimi.ingsw.gc14.Network.RMI.Server.RMIServer;
 import it.polimi.ingsw.gc14.Network.TCP.Server.TCPServer;
 
 /**
  * Forwards every notification to both the RMI and the TCP transport layers.
  *
  * <p>This follows the Composite pattern: the caller interacts with a single
  * broadcaster without knowing which protocols are active underneath.
  */
 public class CompositeClientBroadcaster {
     /** RMI transport used to reach RMI-connected clients. */
     private final RMIServer rmiServer;
     /** TCP transport used to reach TCP-connected clients. */
     private final TCPServer tcpServer;
 
     /**
      * Constructs a composite broadcaster backed by the given RMI and TCP servers.
      *
      * @param rmiServer the RMI server used to reach RMI clients.
      * @param tcpServer the TCP server used to reach TCP clients.
      */
     public CompositeClientBroadcaster(RMIServer rmiServer, TCPServer tcpServer) {
         this.rmiServer = rmiServer;
         this.tcpServer = tcpServer;
     }
 
     /**
      * Forwards the event to both the RMI and the TCP server.
      * Each server is responsible for filtering error events to the
      * requesting player only.
      *
      * @param event the network event to broadcast.
      */
     public void notifyAll(NetworkEvent event) {
         rmiServer.notifyAll(event);
         tcpServer.notifyAll(event);
     }
 
     /**
      * Forwards the model snapshot to every client on both transports.
      *
      * @param model the mini model snapshot to broadcast.
      */
     public void notifyAll(MiniModel model) {
         rmiServer.notifyAll(model);
         tcpServer.notifyAll(model);
     }
 }