Add: Added Coverage Screenshots And htlmReport.
This commit is contained in:
@@ -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>
|
||||
Reference in New Issue
Block a user