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

Class Class, % Method, % Branch, % Line, %
SlotChoice 0% (0/1) 0% (0/3) 0% (0/2) 0% (0/12)


 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.MiniModel;
 import it.polimi.ingsw.gc14.Network.EventType;
 import it.polimi.ingsw.gc14.Network.NetworkEvent;
 
 
 /**
  * NetworkEvent to select a slot where to place the player totem.
  */
 public class SlotChoice extends NetworkEvent {
 
     /** Index of the selected slot. */
     private final int pos;
 
     /**
      * Class constructor.
      * Initializes all the attributes.
      * @param username the name of the player requesting the event
      * @param pos the index of the selected slot
      */
     public SlotChoice(String username, int pos) {
         super(username, EventType.SLOT_CHOICE, false, ErrorType.WRONG_ACTION);
         this.pos = pos;
     }
 
     /**
      * @param gameController the game controller on which to apply the event.
      * @return {@code true} if the slot choice is handled successfully, {@code false} otherwise.
      */
     @Override
     public boolean apply(GameController gameController) {
         return gameController.slotChoice(username, pos);
     }
 
     /**
      * Applies this event to the client-side mini model, updating players,
      * turn order, game state, and slot map after a slot selection.
      *
      * @param miniModel the client-side model to update.
      */
     @Override
     public void apply(MiniModel miniModel){
         synchronized (miniModel) {
             if (isError)
                 return;
             miniModel.setPlayers(playerList);
             miniModel.setOrderLogicCard(orderLogicCard);
             miniModel.setCurrentState(currentState);
             miniModel.setSlotPlayerMap(slotPlayerMap);
             miniModel.setLastEvent(this);
         }
     }
 
 }