Add: Added Coverage Screenshots And htlmReport.
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > AddPlayer</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: AddPlayer (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">AddPlayer</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/4)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/14)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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;
|
||||
|
||||
/**
|
||||
* Network event used to register a new player in the lobby.
|
||||
*
|
||||
* <p>The first player to join also proposes the desired number of players
|
||||
* for the match. Subsequent joiners ignore {@code proposedNPlayer} if the
|
||||
* game has already been created.
|
||||
*/
|
||||
public class AddPlayer extends NetworkEvent {
|
||||
/** Number of players proposed by this player; used only when creating a new game. */
|
||||
private int proposedNPlayer;
|
||||
|
||||
/**
|
||||
* @return the number of proposed players to add to the match
|
||||
*/
|
||||
public int getProposedNPlayer() {
|
||||
<b class="nc"> return proposedNPlayer;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
* @param proposedNPlayer the number of proposed players to add to the match
|
||||
*/
|
||||
public AddPlayer(String username, int proposedNPlayer) {
|
||||
<b class="nc"> super(username, EventType.ADD_PLAYER, false, ErrorType.GENERIC_ERROR);</b>
|
||||
<b class="nc"> this.proposedNPlayer = proposedNPlayer;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could be added to the match, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController)
|
||||
{
|
||||
<b class="nc"> return gameController.addPlayer(username);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this event to the client-side mini model, updating players,
|
||||
* turn order, game state, and slot map.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,200 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > ApplyNextRound</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: ApplyNextRound (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">ApplyNextRound</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/19)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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.Cards.BuildingCard;
|
||||
import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
|
||||
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.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Network event that transitions all clients to the next round.
|
||||
*
|
||||
* <p>Carries refreshed card lists for all four board rows in addition
|
||||
* to the standard game state (slot map, turn order, current state,
|
||||
* player list). Only applied client-side; {@link #apply(GameController)}
|
||||
* always returns {@code false}.
|
||||
*/
|
||||
public class ApplyNextRound extends NetworkEvent {
|
||||
|
||||
private ArrayList<TribeCard> upperListTribeCards;
|
||||
private ArrayList<TribeCard> lowerListTribeCards;
|
||||
private ArrayList<BuildingCard> upperListBuildingCards;
|
||||
private ArrayList<BuildingCard> lowerListBuildingCards;
|
||||
|
||||
|
||||
/**
|
||||
* Constructs an event that updates the game state for the next round.
|
||||
*
|
||||
* @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 list of players in the game.
|
||||
* @param upperListTribeCards the upper row of tribe cards for the new round.
|
||||
* @param lowerListTribeCards the lower row of tribe cards for the new round.
|
||||
* @param upperListBuildingCards the upper row of building cards for the new round.
|
||||
* @param lowerListBuildingCards the lower row of building cards for the new round.
|
||||
*/
|
||||
public ApplyNextRound(Map<Slot, Player> slotPlayerMap,
|
||||
OrderLogicCard orderLogicCard,
|
||||
CurrentState currentState,
|
||||
List<Player> players,
|
||||
ArrayList<TribeCard> upperListTribeCards,
|
||||
ArrayList<TribeCard> lowerListTribeCards,
|
||||
ArrayList<BuildingCard> upperListBuildingCards,
|
||||
ArrayList<BuildingCard> lowerListBuildingCards) {
|
||||
<b class="nc"> super("SERVER", EventType.NEXT_ROUND, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> setData(slotPlayerMap, orderLogicCard, currentState, players);</b>
|
||||
<b class="nc"> this.upperListBuildingCards = upperListBuildingCards;</b>
|
||||
<b class="nc"> this.lowerListBuildingCards = lowerListBuildingCards;</b>
|
||||
<b class="nc"> this.upperListTribeCards = upperListTribeCards;</b>
|
||||
<b class="nc"> this.lowerListTribeCards = lowerListTribeCards;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Not applicable server-side.
|
||||
*
|
||||
* @param gameController the game controller (unused).
|
||||
* @return {@code false} always.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController) {
|
||||
<b class="nc"> return false;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this event to the client-side mini model, updating all board lists,
|
||||
* slot map, turn order, and game state for the new round.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code true} always (this event cannot produce an error).
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel) {
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setUpperListTribeCards(upperListTribeCards);</b>
|
||||
<b class="nc"> miniModel.setLowerListTribeCards(lowerListTribeCards);</b>
|
||||
<b class="nc"> miniModel.setUpperListBuildingCards(upperListBuildingCards);</b>
|
||||
<b class="nc"> miniModel.setLowerListBuildingCards(lowerListBuildingCards);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,193 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > DisconnectedPlayer</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: DisconnectedPlayer (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">DisconnectedPlayer</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/4)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/17)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Game;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Network event used to notify all clients that a player has disconnected.
|
||||
*
|
||||
* <p>Also carries the updated list of available totems, since a disconnection
|
||||
* during totem selection may free a totem for other players.
|
||||
*/
|
||||
public class DisconnectedPlayer extends NetworkEvent {
|
||||
//TODO
|
||||
private List<Totems> availableTotems;
|
||||
|
||||
|
||||
@Override
|
||||
public void enrichWithGameState(Game game, ArrayList<String> disconnectedUsernames) {
|
||||
<b class="nc"> super.enrichWithGameState(game, disconnectedUsernames);</b>
|
||||
<b class="nc"> this.availableTotems = game.getAvailableTotems();</b>
|
||||
<b class="nc"> this.disconnectedPlayers = disconnectedUsernames;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a disconnection event for the specified player.
|
||||
*
|
||||
* @param username the username of the player who disconnected.
|
||||
*/
|
||||
public DisconnectedPlayer(String username) {
|
||||
<b class="nc"> super(username, EventType.DISCONNECTED_PLAYER, false, ErrorType.GENERIC_ERROR);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this disconnection event to the server-side game controller.
|
||||
*
|
||||
* @param gameController the game controller on which to apply the event.
|
||||
* @return {@code true} if the disconnection is handled successfully.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
<b class="nc"> return gameController.disconnectedPlayer(username);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this disconnection event to the client-side mini model,
|
||||
* updating player data, turn order, game state, and disconnected player list.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setDisconnectedPlayers(disconnectedPlayers);</b>
|
||||
<b class="nc"> miniModel.setAvailableTotems(availableTotems);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,177 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > DrawLowerBuildingCard</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: DrawLowerBuildingCard (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">DrawLowerBuildingCard</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/14)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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 draw a building card from the lower card list.
|
||||
*/
|
||||
public class DrawLowerBuildingCard extends NetworkEvent{
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
* @param pos the index of the card to draw
|
||||
*/
|
||||
public DrawLowerBuildingCard(String username, int pos){
|
||||
<b class="nc"> super(username, EventType.DRAW_LOWER_BUILD, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> this.pos = pos;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could draw the card, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
<b class="nc"> return gameController.drawLowerBuildingCard(username, pos);</b>
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Applies this event to the client-side mini model, removing the drawn card
|
||||
* from the lower building list and updating players, turn order, game state, and slot map.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
|
||||
<b class="nc"> miniModel.removeLowerBuildingCard(pos);</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,176 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > DrawLowerTribeCard</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: DrawLowerTribeCard (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">DrawLowerTribeCard</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/14)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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 draw a tribe card from the lower card list.
|
||||
*/
|
||||
public class DrawLowerTribeCard extends NetworkEvent{
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
* @param pos the index of the card to draw
|
||||
*/
|
||||
public DrawLowerTribeCard(String username, int pos){
|
||||
<b class="nc"> super(username, EventType.DRAW_LOWER_TRIBE, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> this.pos = pos;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could draw the card, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
<b class="nc"> return gameController.drawLowerTribeCard(username, pos);</b>
|
||||
}
|
||||
/**
|
||||
* Applies this event to the client-side mini model, removing the drawn card
|
||||
* from the lower tribe list and updating players, turn order, game state, and slot map.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
|
||||
<b class="nc"> miniModel.removeLowerTribeCard(pos);</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,176 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > DrawUpperBuildingCard</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: DrawUpperBuildingCard (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">DrawUpperBuildingCard</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/14)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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 draw a building card from the upper card list.
|
||||
*/
|
||||
public class DrawUpperBuildingCard extends NetworkEvent{
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
* @param pos the index of the card to draw
|
||||
*/
|
||||
public DrawUpperBuildingCard(String username, int pos){
|
||||
<b class="nc"> super(username, EventType.DRAW_UPPER_BUILD, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> this.pos = pos;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could draw the card, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
<b class="nc"> return gameController.drawUpperBuildingCard(username, pos);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this event to the client-side mini model, removing the drawn card
|
||||
* from the upper building list and updating players, turn order, game state, and slot map.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
|
||||
<b class="nc"> miniModel.removeUpperBuildingCard(pos);</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,176 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > DrawUpperTribeCard</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: DrawUpperTribeCard (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">DrawUpperTribeCard</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/14)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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 draw a tribe card from the upper card list.
|
||||
*/
|
||||
public class DrawUpperTribeCard extends NetworkEvent{
|
||||
|
||||
/** Index of the card to draw */
|
||||
private int pos;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
* @param pos the index of the card to draw
|
||||
*/
|
||||
public DrawUpperTribeCard(String username, int pos){
|
||||
<b class="nc"> super(username, EventType.DRAW_UPPER_TRIBE, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> this.pos = pos;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could draw the card, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
<b class="nc"> return gameController.drawUpperTribeCard(username, pos);</b>
|
||||
}
|
||||
/**
|
||||
* Applies this event to the client-side mini model, removing the drawn card
|
||||
* from the upper tribe list and updating players, turn order, game state, and slot map.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
<b class="nc"> miniModel.removeUpperTribeCard(pos);</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,173 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > EndedGame</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: EndedGame (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">EndedGame</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/12)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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) {
|
||||
<b class="nc"> super("SERVER", EventType.ENDED_GAME, false, ErrorType.GENERIC_ERROR);</b>
|
||||
<b class="nc"> setData(slotPlayerMap, orderLogicCard, currentState, players);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Not applicable server-side.
|
||||
*
|
||||
* @param gameController the game controller (unused).
|
||||
* @return {@code false} always.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController) {
|
||||
<b class="nc"> return false;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return {@code true} always (this event cannot produce an error).
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel) {
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setStandingPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,184 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > ReconnectPlayer</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: ReconnectPlayer (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">ReconnectPlayer</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/4)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/15)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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.Game;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Network event used to notify that a player has reconnected to the game.
|
||||
*/
|
||||
public class ReconnectPlayer extends NetworkEvent {
|
||||
|
||||
@Override
|
||||
public void enrichWithGameState(Game game, ArrayList<String> disconnectedUsernames) {
|
||||
<b class="nc"> super.enrichWithGameState(game, disconnectedUsernames);</b>
|
||||
<b class="nc"> this.disconnectedPlayers = disconnectedUsernames;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a reconnection event for the specified player.
|
||||
*
|
||||
* @param username the username of the player who reconnected.
|
||||
*/
|
||||
public ReconnectPlayer(String username) {
|
||||
<b class="nc"> super(username, EventType.RECONNECT_PLAYER, false, ErrorType.GENERIC_ERROR);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the reconnection event to the server-side game controller.
|
||||
*
|
||||
* @param gameController the game controller on which to apply the event.
|
||||
* @return {@code true} if the player reconnection is handled successfully,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController) {
|
||||
<b class="nc"> return gameController.reconnectPlayer(username);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the reconnection update to the client-side mini model.
|
||||
*
|
||||
* <p>If the event does not represent an error, the player data,
|
||||
* turn order, current game state, and slot assignments are updated.
|
||||
*
|
||||
* @param miniModel the mini model on which to apply the event.
|
||||
* @return {@code true} if the update is applied successfully,
|
||||
* {@code false} if the event represents an error.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel) {
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setDisconnectedPlayers(disconnectedPlayers);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,169 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > SkipTurn</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: SkipTurn (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">SkipTurn</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/12)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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;
|
||||
|
||||
/**
|
||||
* Network event used to skip the current player's optional card action.
|
||||
*/
|
||||
public class SkipTurn extends NetworkEvent {
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
*/
|
||||
public SkipTurn(String username){
|
||||
<b class="nc"> super(username, EventType.SKIP_TURN, false, ErrorType.WRONG_ACTION);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could skipTheTurn, false otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
<b class="nc"> return gameController.skipTurn(username);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this event to the client-side mini model, updating players,
|
||||
* turn order, game state, and slot map after a skip turn action.
|
||||
*
|
||||
* @param miniModel the client-side model to update.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > SlotChoice</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: SlotChoice (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">SlotChoice</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/3)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/13)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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 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) {
|
||||
<b class="nc"> super(username, EventType.SLOT_CHOICE, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> this.pos = pos;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* @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) {
|
||||
<b class="nc"> return gameController.slotChoice(username, pos);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @return {@code false} if the event is marked as an error; {@code true} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel){
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,210 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > TotemChoice</title>
|
||||
<style type="text/css">
|
||||
@import "../../css/coverage.css";
|
||||
@import "../../css/idea.min.css";
|
||||
</style>
|
||||
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
||||
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="content">
|
||||
<div class="breadCrumbs">
|
||||
Current scope: <a href="../../index.html">all classes</a>
|
||||
<span class="separator">|</span>
|
||||
<a href="../index.html">it.polimi.ingsw.gc14.Network.NetworkEvents</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: TotemChoice (it.polimi.ingsw.gc14.Network.NetworkEvents)</h1>
|
||||
|
||||
<table class="coverageStats">
|
||||
<tr>
|
||||
<th class="name">Class</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Class, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Method, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Branch, %
|
||||
</th>
|
||||
<th class="coverageStat
|
||||
">
|
||||
Line, %
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="name">TotemChoice</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/1)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/5)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/2)
|
||||
</span>
|
||||
</td>
|
||||
<td class="coverageStat">
|
||||
<span class="percent">
|
||||
0%
|
||||
</span>
|
||||
<span class="absValue">
|
||||
(0/17)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> 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.Game;
|
||||
import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Model.Totems;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Network event used to handle a player's totem choice.
|
||||
*/
|
||||
public class TotemChoice extends NetworkEvent implements Serializable {
|
||||
|
||||
/**
|
||||
* Name of the totem selected by the player.
|
||||
*/
|
||||
private String totem;
|
||||
|
||||
/**
|
||||
* List of totems still available after the choice has been processed.
|
||||
*/
|
||||
private List<Totems> availableTotems;
|
||||
|
||||
/**
|
||||
* Sets the list of currently available totems.
|
||||
*
|
||||
* @param availableTotems the totems still available for selection.
|
||||
*/
|
||||
public void setAvailableTotems(List<Totems> availableTotems) {
|
||||
<b class="nc"> this.availableTotems = availableTotems;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a totem choice event for the specified player.
|
||||
*
|
||||
* @param username the username of the player making the choice.
|
||||
* @param totem the name of the selected totem.
|
||||
*/
|
||||
public TotemChoice(String username, String totem) {
|
||||
<b class="nc"> super(username, EventType.TOTEM_CHOICE, false, ErrorType.WRONG_ACTION);</b>
|
||||
<b class="nc"> this.totem = totem;</b>
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enrichWithGameState(Game game, ArrayList<String> disconnectedUsernames) {
|
||||
<b class="nc"> super.enrichWithGameState(game, disconnectedUsernames);</b>
|
||||
<b class="nc"> this.availableTotems = game.getAvailableTotems();</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the totem choice event to the server-side game controller.
|
||||
*
|
||||
* @param gameController the game controller on which to apply the event.
|
||||
* @return {@code true} if the totem choice is handled successfully,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController) {
|
||||
<b class="nc"> return gameController.totemChoice(username, totem);</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the totem choice update to the client-side mini model.
|
||||
*
|
||||
* <p>If the event does not represent an error, the player data,
|
||||
* turn order, current game state, slot assignments, and available
|
||||
* totems are updated.
|
||||
*
|
||||
* @param miniModel the mini model on which to apply the event.
|
||||
* @return {@code true} if the update is applied successfully,
|
||||
* {@code false} if the event represents an error.
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(MiniModel miniModel) {
|
||||
<b class="nc"> synchronized (miniModel) {</b>
|
||||
<b class="nc"> if (isError)</b>
|
||||
<b class="nc"> return false;</b>
|
||||
|
||||
<b class="nc"> miniModel.setPlayers(playerList);</b>
|
||||
<b class="nc"> miniModel.setOrderLogicCard(orderLogicCard);</b>
|
||||
<b class="nc"> miniModel.setCurrentState(currentState);</b>
|
||||
<b class="nc"> miniModel.setSlotPlayerMap(slotPlayerMap);</b>
|
||||
<b class="nc"> miniModel.setAvailableTotems(availableTotems);</b>
|
||||
<b class="nc"> miniModel.setLastEvent(this);</b>
|
||||
<b class="nc"> return true;</b>
|
||||
<b class="nc"> }</b>
|
||||
}
|
||||
}
|
||||
</code>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
(function() {
|
||||
var msie = false, msie9 = false;
|
||||
/*@cc_on
|
||||
msie = true;
|
||||
@if (@_jscript_version >= 9)
|
||||
msie9 = true;
|
||||
@end
|
||||
@*/
|
||||
|
||||
if (!msie || msie && msie9) {
|
||||
hljs.highlightAll()
|
||||
hljs.initLineNumbersOnLoad();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<div style="float:right;">generated on 2026-06-14 21:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user