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

Class Class, % Method, % Line, %
EndedGame 0% (0/1) 0% (0/3) 0% (0/11)


 package it.polimi.ingsw.gc14.Network.NetworkEvents;
 
 import it.polimi.ingsw.gc14.Controller.GameController;
 import it.polimi.ingsw.gc14.ErrorType;
 import it.polimi.ingsw.gc14.Model.GamePackage.CurrentState;
 import it.polimi.ingsw.gc14.Model.MiniModel;
 import it.polimi.ingsw.gc14.Model.OrderLogicCard;
 import it.polimi.ingsw.gc14.Model.Player;
 import it.polimi.ingsw.gc14.Model.Slot;
 import it.polimi.ingsw.gc14.Network.EventType;
 import it.polimi.ingsw.gc14.Network.NetworkEvent;
 
 import java.util.ArrayList;
 import java.util.Map;
 
 /**
  * Network event that signals the end of the game and delivers the final standings.
  *
  * <p>Only applied client-side; {@link #apply(GameController)} always returns {@code false}.
  */
 public class EndedGame extends NetworkEvent {
 
     /**
      * Constructs an event containing the final game state.
      *
      * @param slotPlayerMap  the map associating each slot with the player occupying it.
      * @param orderLogicCard the order logic card that determines the player order.
      * @param currentState   the current state of the game.
      * @param players        the final list of players, used as the standings.
      */
     public EndedGame(Map<Slot, Player> slotPlayerMap,
                      OrderLogicCard orderLogicCard,
                      CurrentState currentState,
                      ArrayList<Player> players) {
         super("SERVER", EventType.ENDED_GAME, false, ErrorType.GENERIC_ERROR);
         setData(slotPlayerMap, orderLogicCard, currentState, players);
     }
 
     /**
      * Not applicable server-side.
      *
      * @param gameController the game controller (unused).
      * @return {@code false} always.
      */
     @Override
     public boolean apply(GameController gameController) {
         return false;
     }
 
     /**
      * Applies this event to the client-side mini model, updating the final
      * game state and setting the standings list for the leaderboard.
      *
      * @param miniModel the client-side model to update.
      */
     @Override
     public void apply(MiniModel miniModel) {
         synchronized (miniModel) {
             miniModel.setSlotPlayerMap(slotPlayerMap);
             miniModel.setOrderLogicCard(orderLogicCard);
             miniModel.setCurrentState(currentState);
             miniModel.setPlayers(playerList);
             miniModel.setStandingPlayers(playerList);
             miniModel.setLastEvent(this);
         }
     }
 }