FIx: Fixed Coverage Screenshots And htmlRepot.
This commit is contained in:
@@ -0,0 +1,317 @@
|
||||
|
||||
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html id="htmlId">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
||||
<title>Coverage Report > NetworkEvent</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</a>
|
||||
</div>
|
||||
|
||||
<h1>Coverage Summary for Class: NetworkEvent (it.polimi.ingsw.gc14.Network)</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">NetworkEvent</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/10)
|
||||
</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/19)
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<pre>
|
||||
<code class="sourceCode" id="sourceCode"> package it.polimi.ingsw.gc14.Network;
|
||||
|
||||
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.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 java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents an event sent over the network.
|
||||
*
|
||||
* <p>A network event contains the information required to identify
|
||||
* the requested action, determine whether it produced an error,
|
||||
* and apply it either to the server-side {@link GameController}
|
||||
* or to the client-side {@link MiniModel}.
|
||||
*/
|
||||
public abstract class NetworkEvent implements Serializable {
|
||||
|
||||
/** The error type associated with this event; set when the event failed to apply. */
|
||||
protected ErrorType errorType;
|
||||
|
||||
/**
|
||||
* Returns the error type associated with this event.
|
||||
*
|
||||
* @return the error type, or {@code null} if no error occurred.
|
||||
*/
|
||||
public ErrorType getErrorType() {
|
||||
<b class="nc"> return errorType;</b>
|
||||
}
|
||||
/**
|
||||
* Username of the player requesting the event.
|
||||
*/
|
||||
protected final String username;
|
||||
|
||||
/**
|
||||
* Returns the username of the player requesting the event.
|
||||
*
|
||||
* @return the username associated with the event.
|
||||
*/
|
||||
public String getUsername() {
|
||||
<b class="nc"> return username;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of the network event.
|
||||
*/
|
||||
protected final EventType eventType;
|
||||
|
||||
/**
|
||||
* Map associating each occupied slot with the corresponding player.
|
||||
*/
|
||||
protected Map<Slot, Player> slotPlayerMap;
|
||||
|
||||
/**
|
||||
* Order logic card used to manage the player turn order.
|
||||
*/
|
||||
protected OrderLogicCard orderLogicCard;
|
||||
|
||||
/**
|
||||
* Current state of the game associated with the event.
|
||||
*/
|
||||
protected CurrentState currentState;
|
||||
|
||||
/**
|
||||
* List of all players.
|
||||
*/
|
||||
protected List<Player> playerList;
|
||||
|
||||
/**
|
||||
* Usernames of players currently disconnected from the game.
|
||||
* Sent with every event so clients always have an up-to-date list.
|
||||
*/
|
||||
protected ArrayList<String> disconnectedPlayers;
|
||||
|
||||
/**
|
||||
* Populates this event with the current game state so clients can
|
||||
* update their local model after receiving it.
|
||||
* Subclasses that carry extra state (available totems, etc.) override
|
||||
* this method and call {@code super} first.
|
||||
*
|
||||
* @param game the current game model.
|
||||
* @param disconnectedUsernames usernames of currently disconnected players.
|
||||
*/
|
||||
public void enrichWithGameState(Game game, ArrayList<String> disconnectedUsernames) {
|
||||
<b class="nc"> setData(game.getSlotMap(), game.getOrderLogicCard(), game.getCurrentState(), game.getPlayers());</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the game data associated with this network event.
|
||||
*
|
||||
* @param slotPlayerMap the map associating each slot with the player occupying it.
|
||||
* @param orderLogicCard the order logic card used to manage turn order.
|
||||
* @param currentState the current state of the game.
|
||||
* @param playerList the list of the actual state of the players
|
||||
*/
|
||||
public void setData(Map<Slot, Player> slotPlayerMap,
|
||||
OrderLogicCard orderLogicCard,
|
||||
CurrentState currentState,
|
||||
List<Player> playerList) {
|
||||
<b class="nc"> this.slotPlayerMap = slotPlayerMap;</b>
|
||||
<b class="nc"> this.orderLogicCard = orderLogicCard;</b>
|
||||
<b class="nc"> this.currentState = currentState;</b>
|
||||
<b class="nc"> this.playerList = playerList;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of this event.
|
||||
*
|
||||
* @return the event type.
|
||||
*/
|
||||
public EventType getEventType() {
|
||||
<b class="nc"> return eventType;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag indicating whether the event could not be applied successfully.
|
||||
*/
|
||||
protected boolean isError;
|
||||
|
||||
/**
|
||||
* Returns whether the event represents an error.
|
||||
*
|
||||
* @return {@code true} if the event could not be applied successfully,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public boolean isError() {
|
||||
<b class="nc"> return isError;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the event represents an error.
|
||||
*
|
||||
* @param isError {@code true} if the event could not be applied successfully,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public void setIsError(boolean isError) {
|
||||
<b class="nc"> this.isError = isError;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Overrides the error type for this event.
|
||||
*
|
||||
* @param errorType the error type to set.
|
||||
*/
|
||||
public void setErrorType(ErrorType errorType) {
|
||||
<b class="nc"> this.errorType = errorType;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a network event.
|
||||
*
|
||||
* @param username the username of the player requesting the event.
|
||||
* @param eventType the type of the event.
|
||||
* @param isError {@code true} if the event represents an error,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
<b class="nc"> protected NetworkEvent(String username, EventType eventType, boolean isError, ErrorType errorType) {</b>
|
||||
<b class="nc"> this.username = username;</b>
|
||||
<b class="nc"> this.eventType = eventType;</b>
|
||||
<b class="nc"> this.isError = isError;</b>
|
||||
<b class="nc"> this.errorType = errorType;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a textual description of the event and its outcome.
|
||||
*
|
||||
* @return a string describing the event type and whether it represents an error.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
<b class="nc"> if (isError) {</b>
|
||||
<b class="nc"> return "ERROR: " + eventType;</b>
|
||||
} else {
|
||||
<b class="nc"> return "ACTION: " + eventType;</b>
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies this event to the specified server-side game controller.
|
||||
*
|
||||
* @param gameController the game controller on which the event must be applied.
|
||||
* @return {@code true} if the event is applied successfully,
|
||||
* {@code false} otherwise.
|
||||
*/
|
||||
public abstract boolean apply(GameController gameController);
|
||||
|
||||
/**
|
||||
* Applies this event to the specified client-side mini model.
|
||||
*
|
||||
* @param model the mini model on which the event must be applied.
|
||||
*/
|
||||
public abstract void apply(MiniModel model);
|
||||
}
|
||||
</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-19 22:53</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user