FIx: Fixed Coverage Screenshots And htmlRepot.

This commit is contained in:
GabrieleRadice
2026-06-19 22:57:43 +02:00
parent a4dc8b2540
commit 0129efe400
316 changed files with 4566 additions and 4497 deletions
@@ -0,0 +1,381 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > MiniModel</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.Model</a>
</div>
<h1>Coverage Summary for Class: MiniModel (it.polimi.ingsw.gc14.Model)</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">MiniModel</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/18)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/14)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.BuildingCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCard;
&nbsp;import it.polimi.ingsw.gc14.Model.GamePackage.CurrentState;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkEvent;
&nbsp;
&nbsp;import java.io.Serializable;
&nbsp;import java.util.*;
&nbsp;
&nbsp;/**
&nbsp; * Lightweight representation of the game model shared with clients.
&nbsp; *
&nbsp; * &lt;p&gt;The mini model contains only the information required by the client-side
&nbsp; * view and controllers to render the current match state and process incoming
&nbsp; * network updates.
&nbsp; */
&nbsp;public class MiniModel implements Serializable {
&nbsp;
&nbsp; /** Upper row of tribe cards currently on the board. */
&nbsp; public ArrayList&lt;TribeCard&gt; upperListTribeCards;
&nbsp; /** Lower row of tribe cards currently on the board. */
&nbsp; public ArrayList&lt;TribeCard&gt; lowerListTribeCards;
&nbsp; /** Upper row of building cards currently on the board. */
&nbsp; public ArrayList&lt;BuildingCard&gt; upperListBuildingCards;
&nbsp; /** Lower row of building cards currently on the board. */
&nbsp; public ArrayList&lt;BuildingCard&gt; lowerListBuildingCards;
&nbsp; /** Usernames of players currently disconnected from the game. */
&nbsp; public ArrayList&lt;String&gt; disconnectedPlayers;
&nbsp; /** The most recent network event applied to this model. */
&nbsp; public NetworkEvent lastEvent;
&nbsp;
&nbsp; /**
&nbsp; * Map associating each occupied slot with the corresponding player.
&nbsp; */
&nbsp; public Map&lt;Slot, Player&gt; slotPlayerMap;
&nbsp;
&nbsp; /**
&nbsp; * Card used to manage the player turn order.
&nbsp; */
&nbsp; public OrderLogicCard orderLogicCard;
&nbsp;
&nbsp; /**
&nbsp; * Current state of the game.
&nbsp; */
&nbsp; public CurrentState currentState;
&nbsp;
&nbsp; /**
&nbsp; * Map of players indexed by username.
&nbsp; */
&nbsp; public final Map&lt;String, Player&gt; players;
&nbsp;
&nbsp; /**
&nbsp; * List of totems still available for selection.
&nbsp; */
&nbsp; public List&lt;Totems&gt; availableTotems;
&nbsp;
&nbsp; /**
&nbsp; * Final standing of the players at the end of the game.
&nbsp; */
&nbsp; public List&lt;Player&gt; standingPlayers;
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Constructs a complete mini model from the current server-side game data.
&nbsp; *
&nbsp; * @param slotPlayerMap the map associating occupied slots with players.
&nbsp; * @param orderLogicCard the card managing player turn order.
&nbsp; * @param currentState the current state of the game.
&nbsp; * @param players the list of players in the match.
&nbsp; * @param availableTotems the list of totems still available for selection.
&nbsp; * @param upperListTribeCards the upper row of tribe cards on the board.
&nbsp; * @param lowerListTribeCards the lower row of tribe cards on the board.
&nbsp; * @param upperListBuildingCards the upper row of building cards on the board.
&nbsp; * @param lowerListBuildingCards the lower row of building cards on the board.
&nbsp; * @param disconnectedPlayers the list of usernames of currently disconnected players.
&nbsp; */
&nbsp; public MiniModel(Map&lt;Slot, Player&gt; slotPlayerMap,
&nbsp; OrderLogicCard orderLogicCard,
&nbsp; CurrentState currentState,
&nbsp; List&lt;Player&gt; players,
<b class="nc">&nbsp; List&lt;Totems&gt; availableTotems,ArrayList&lt;TribeCard&gt; upperListTribeCards,ArrayList&lt;TribeCard&gt;lowerListTribeCards,ArrayList&lt;BuildingCard&gt; upperListBuildingCards,ArrayList&lt;BuildingCard&gt;lowerListBuildingCards, ArrayList&lt;String&gt; disconnectedPlayers) {</b>
&nbsp;
<b class="nc">&nbsp; this.slotPlayerMap = slotPlayerMap;</b>
<b class="nc">&nbsp; this.orderLogicCard = orderLogicCard;</b>
<b class="nc">&nbsp; this.currentState = currentState;</b>
<b class="nc">&nbsp; this.players = new LinkedHashMap&lt;&gt;();</b>
<b class="nc">&nbsp; this.availableTotems = availableTotems;</b>
<b class="nc">&nbsp; this.standingPlayers = new ArrayList&lt;&gt;();</b>
<b class="nc">&nbsp; this.upperListTribeCards = upperListTribeCards;</b>
<b class="nc">&nbsp; this.lowerListTribeCards = lowerListTribeCards;</b>
<b class="nc">&nbsp; this.upperListBuildingCards = upperListBuildingCards;</b>
<b class="nc">&nbsp; this.lowerListBuildingCards = lowerListBuildingCards;</b>
<b class="nc">&nbsp; this.disconnectedPlayers = disconnectedPlayers;</b>
<b class="nc">&nbsp; setPlayers(players);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Sets the last network event applied to the game state.
&nbsp; *
&nbsp; * @param lastEvent the most recent event received from the server.
&nbsp; */
&nbsp; public void setLastEvent(NetworkEvent lastEvent) {
<b class="nc">&nbsp; this.lastEvent = lastEvent;</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Sets the list of totems still available for selection.
&nbsp; *
&nbsp; * @param availableTotems the available totems.
&nbsp; */
&nbsp; public void setAvailableTotems(List&lt;Totems&gt; availableTotems) {
<b class="nc">&nbsp; this.availableTotems = availableTotems;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Sets the map associating occupied slots with players.
&nbsp; *
&nbsp; * @param slotPlayerMap the slot-player map to assign.
&nbsp; */
&nbsp; public void setSlotPlayerMap(Map&lt;Slot, Player&gt; slotPlayerMap) {
<b class="nc">&nbsp; this.slotPlayerMap = slotPlayerMap;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Sets the card used to manage the player turn order.
&nbsp; *
&nbsp; * @param orderLogicCard the order logic card to assign.
&nbsp; */
&nbsp; public void setOrderLogicCard(OrderLogicCard orderLogicCard) {
<b class="nc">&nbsp; this.orderLogicCard = orderLogicCard;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Sets the current state of the game.
&nbsp; *
&nbsp; * @param currentState the current game state.
&nbsp; */
&nbsp; public void setCurrentState(CurrentState currentState) {
<b class="nc">&nbsp; this.currentState = currentState;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Replaces or updates the players stored in the mini model.
&nbsp; *
&nbsp; * &lt;p&gt;Each player is indexed by username.
&nbsp; *
&nbsp; * @param players the list of players to store.
&nbsp; */
&nbsp; public void setPlayers(List&lt;Player&gt; players) {
<b class="nc">&nbsp; for (Player player : players) {</b>
<b class="nc">&nbsp; this.players.put(player.getUserName(), player);</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Sets the final standing of the players.
&nbsp; *
&nbsp; * @param standingPlayers the final ordered list of players.
&nbsp; */
&nbsp; public void setStandingPlayers(List&lt;Player&gt; standingPlayers) {
<b class="nc">&nbsp; this.standingPlayers = standingPlayers;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Replaces the upper row of tribe cards on the board.
&nbsp; *
&nbsp; * @param cards the new upper tribe card list.
&nbsp; */
&nbsp; public void setUpperListTribeCards(ArrayList&lt;TribeCard&gt; cards) {
<b class="nc">&nbsp; this.upperListTribeCards = cards;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Replaces the lower row of tribe cards on the board.
&nbsp; *
&nbsp; * @param cards the new lower tribe card list.
&nbsp; */
&nbsp; public void setLowerListTribeCards(ArrayList&lt;TribeCard&gt; cards) {
<b class="nc">&nbsp; this.lowerListTribeCards = cards;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Replaces the upper row of building cards on the board.
&nbsp; *
&nbsp; * @param cards the new upper building card list.
&nbsp; */
&nbsp; public void setUpperListBuildingCards(ArrayList&lt;BuildingCard&gt; cards) {
<b class="nc">&nbsp; this.upperListBuildingCards = cards;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Replaces the lower row of building cards on the board.
&nbsp; *
&nbsp; * @param cards the new lower building card list.
&nbsp; */
&nbsp; public void setLowerListBuildingCards(ArrayList&lt;BuildingCard&gt; cards) {
<b class="nc">&nbsp; this.lowerListBuildingCards = cards;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Removes the card at the given position from the upper tribe card list.
&nbsp; *
&nbsp; * @param pos the zero-based index of the card to remove.
&nbsp; */
&nbsp; public void removeUpperTribeCard(int pos) {
<b class="nc">&nbsp; if (upperListTribeCards != null) upperListTribeCards.remove(pos);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Removes the card at the given position from the lower tribe card list.
&nbsp; *
&nbsp; * @param pos the zero-based index of the card to remove.
&nbsp; */
&nbsp; public void removeLowerTribeCard(int pos) {
<b class="nc">&nbsp; if (lowerListTribeCards != null) lowerListTribeCards.remove(pos);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Removes the card at the given position from the upper building card list.
&nbsp; *
&nbsp; * @param pos the zero-based index of the card to remove.
&nbsp; */
&nbsp; public void removeUpperBuildingCard(int pos) {
<b class="nc">&nbsp; if (upperListBuildingCards != null) upperListBuildingCards.remove(pos);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Removes the card at the given position from the lower building card list.
&nbsp; *
&nbsp; * @param pos the zero-based index of the card to remove.
&nbsp; */
&nbsp; public void removeLowerBuildingCard(int pos) {
<b class="nc">&nbsp; if (lowerListBuildingCards != null) lowerListBuildingCards.remove(pos);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Returns the position of the player with the specified username
&nbsp; * within the player collection.
&nbsp; *
&nbsp; * @param username the username of the player to search for.
&nbsp; * @return the zero-based position of the player, or {@code -1}
&nbsp; * if no matching username is found.
&nbsp; */
&nbsp; public int getPositionByUsername(String username) {
<b class="nc">&nbsp; int i = 0;</b>
<b class="nc">&nbsp; for (Player player : players.values()) {</b>
<b class="nc">&nbsp; if (player.getUserName().equals(username)) {</b>
<b class="nc">&nbsp; return i;</b>
&nbsp; }
<b class="nc">&nbsp; i++;</b>
&nbsp; }
<b class="nc">&nbsp; return -1;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Sets the list of usernames of currently disconnected players.
&nbsp; *
&nbsp; * @param disconnectedPlayers the list of disconnected player usernames.
&nbsp; */
&nbsp; public void setDisconnectedPlayers (ArrayList&lt;String&gt; disconnectedPlayers){
<b class="nc">&nbsp; this.disconnectedPlayers=disconnectedPlayers;</b>
&nbsp; }
&nbsp;}
</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>