Add: Added Coverage Screenshots And htlmReport.

This commit is contained in:
GabrieleRadice
2026-06-19 21:50:38 +02:00
parent 6aca188aa3
commit d78b8bbd93
316 changed files with 86329 additions and 0 deletions
@@ -0,0 +1,424 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > Board</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.GamePackage</a>
</div>
<h1>Coverage Summary for Class: Board (it.polimi.ingsw.gc14.Model.GamePackage)</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">Board</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(16/16)
</span>
</td>
<td class="coverageStat">
<span class="percent">
96.7%
</span>
<span class="absValue">
(29/30)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(82/82)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.GamePackage;
&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.Cards.TribeCards.EventCard;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events.ShamanicRitual;
&nbsp;import it.polimi.ingsw.gc14.Model.Cards.TribeCards.Events.Sustenance;
&nbsp;import it.polimi.ingsw.gc14.Model.DecksCreator;
&nbsp;import it.polimi.ingsw.gc14.Model.Slot;
&nbsp;
&nbsp;import java.io.Serializable;
&nbsp;import java.util.*;
&nbsp;import java.util.stream.Collectors;
&nbsp;
&nbsp;/**
&nbsp; * Board manages all the elements during the game such as decks, upper and lower rows, totems, tiles...
&nbsp; */
&nbsp;public class Board implements Serializable {
&nbsp; /**
&nbsp; * slotList contains the ordered list of slots (tiles). The slots changes based on the number of players.
&nbsp; * Each slot (tile) has special action as drawing from the upper/lower row or taking food.
&nbsp; */
&nbsp; private List&lt;Slot&gt; slotList;
&nbsp;
&nbsp; /** tribeDeck is the deck from where you draw tribe cards as characters and events. */
&nbsp; private Queue&lt;TribeCard&gt; tribeDeck;
&nbsp;
&nbsp; /**
&nbsp; * The upper row of tribe cards. It contains a total of
&nbsp; * {@code nTotem + 4} tribe cards, which may include both character and event cards.
&nbsp; */
&nbsp; private List&lt;TribeCard&gt; upperListTribe;
&nbsp;
&nbsp; /**
&nbsp; * The lower row of the tribe card. During the first round, there will be (num. of players + 1) character cards.
&nbsp; * During the following rounds, lower row will be emptied and populated with upper row&#39;s cards.
&nbsp; * When an Event card gets in the lower row, the event effect will be activated at the end of the round.
&nbsp; */
&nbsp; private List&lt;TribeCard&gt; lowerListTribe;
&nbsp;
&nbsp; /** Contains all the building cards of the upper list. When a new era starts, all its building cards are placed here. */
&nbsp; private List&lt;BuildingCard&gt; upperListBuilding;
&nbsp;
&nbsp; /** Contains all the building cards of the lower list. When a new era starts, the old era&#39;s buildings are moved from the upper to the lower list. */
&nbsp; private List&lt;BuildingCard&gt; lowerListBuilding;
&nbsp;
&nbsp; /**
&nbsp; * Returns the upper row of tribe cards.
&nbsp; *
&nbsp; * @return the live upper tribe card list.
&nbsp; */
<b class="fc">&nbsp; public List&lt;TribeCard&gt; getUpperListTribe() { return upperListTribe; }</b>
&nbsp;
&nbsp; /**
&nbsp; * Returns the lower row of tribe cards.
&nbsp; *
&nbsp; * @return the live lower tribe card list.
&nbsp; */
<b class="fc">&nbsp; public List&lt;TribeCard&gt; getLowerListTribe() { return lowerListTribe; }</b>
&nbsp;
&nbsp; /**
&nbsp; * Returns the upper row of building cards.
&nbsp; *
&nbsp; * @return the live upper building card list.
&nbsp; */
<b class="fc">&nbsp; public List&lt;BuildingCard&gt; getUpperListBuilding() { return upperListBuilding; }</b>
&nbsp;
&nbsp; /**
&nbsp; * Returns the lower row of building cards.
&nbsp; *
&nbsp; * @return the live lower building card list.
&nbsp; */
<b class="fc">&nbsp; public List&lt;BuildingCard&gt; getLowerListBuilding() { return lowerListBuilding; }</b>
&nbsp;
&nbsp; // TODO
&nbsp; private final ArrayList&lt;List&lt;BuildingCard&gt;&gt; buildingCardsAllEras;
&nbsp; /** Number of players */
&nbsp; private int nTotem;
&nbsp;
&nbsp; /** Current era of the game */
&nbsp; private int era;
&nbsp;
&nbsp; /**
&nbsp; * Creates and returns a new list containing the slots (tiles) of the game.
&nbsp; *
&nbsp; * @return a copy of the slot list.
&nbsp; */
&nbsp; public List&lt;Slot&gt; getSlotList(){
<b class="fc">&nbsp; return slotList.stream().map(x-&gt;new Slot(x.getSlotId())).collect(Collectors.toList());</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * @return the size of the TribeDeck
&nbsp; */
&nbsp; public int getTribeDeckSize() {
<b class="fc">&nbsp; return this.tribeDeck.size();</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * @return the game era
&nbsp; */
<b class="fc">&nbsp; public int getEra() {return this.era;}</b>
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Creates and initializes a new board:
&nbsp; * - Generate the slotList using a method of DecksCreator.
&nbsp; * - Generate the tribeDeck.
&nbsp; * - Populate the lower list (if there is an event card, it&#39;s added to the upper list).
&nbsp; * - Populate the upper list.
&nbsp; * - Generate the buildingDeck using a method of DecksCreator.
&nbsp; *
&nbsp; * @param nTotem the number of players.
&nbsp; */
<b class="fc">&nbsp; public Board(int nTotem) {</b>
<b class="fc">&nbsp; this.nTotem = nTotem;</b>
<b class="fc">&nbsp; this.slotList = DecksCreator.loadSlotDeck().stream().filter(x-&gt;x.getNMinPlayer()&lt;=nTotem).sorted(Comparator.comparingInt(Slot::getSlotId)).toList();</b>
<b class="fc">&nbsp; upperListTribe=new ArrayList&lt;&gt;();</b>
<b class="fc">&nbsp; lowerListTribe=new ArrayList&lt;&gt;();</b>
<b class="fc">&nbsp; lowerListBuilding=new ArrayList&lt;&gt;();</b>
<b class="fc">&nbsp; tribeDeck=generateTribeDeck(nTotem);</b>
<b class="fc">&nbsp; era=1;</b>
&nbsp;
&nbsp;
<b class="fc">&nbsp; for(int i=0;i&lt;nTotem+1;i++)</b>
&nbsp; {
<b class="fc">&nbsp; TribeCard tempCard = tribeDeck.remove();</b>
<b class="fc">&nbsp; if(tempCard.isEventCard())</b>
&nbsp; {
<b class="fc">&nbsp; upperListTribe.add(tempCard);</b>
<b class="fc">&nbsp; i--;</b>
&nbsp; }
&nbsp; else
&nbsp; {
<b class="fc">&nbsp; lowerListTribe.add(tempCard);</b>
&nbsp; }
&nbsp; }
&nbsp;
<b class="fc">&nbsp; for(int i=upperListTribe.size();i&lt;nTotem+4;i++)</b>
&nbsp; {
<b class="fc">&nbsp; TribeCard tempCard = tribeDeck.remove();</b>
<b class="fc">&nbsp; upperListTribe.add(tempCard);</b>
&nbsp; }
&nbsp;
<b class="fc">&nbsp; ArrayList&lt;BuildingCard&gt; buildingDeck = new ArrayList&lt;&gt;(DecksCreator.loadBuildingDeckByEra(1));</b>
<b class="fc">&nbsp; Collections.shuffle(buildingDeck);</b>
<b class="fc">&nbsp; buildingCardsAllEras= new ArrayList&lt;&gt;();</b>
<b class="fc">&nbsp; buildingCardsAllEras.add(new ArrayList&lt;&gt;());</b>
<b class="fc">&nbsp; buildingCardsAllEras.add(new ArrayList&lt;&gt;());</b>
<b class="fc">&nbsp; buildingCardsAllEras.add(new ArrayList&lt;&gt;());</b>
<b class="fc">&nbsp; if(nTotem==2)</b>
&nbsp; {
<b class="fc">&nbsp; buildingCardsAllEras.set(0, new ArrayList&lt;&gt;(buildingDeck.subList(0, 1)));</b>
<b class="fc">&nbsp; upperListBuilding = new ArrayList&lt;&gt;(buildingDeck.subList(0,1));</b>
&nbsp; }
&nbsp; else
&nbsp; {
<b class="fc">&nbsp; buildingCardsAllEras.set(0, new ArrayList&lt;&gt;(buildingDeck.subList(0, 2)));</b>
<b class="fc">&nbsp; upperListBuilding = new ArrayList&lt;&gt;(buildingDeck.subList(0,2));</b>
&nbsp; }
&nbsp;
<b class="fc">&nbsp; buildingDeck=new ArrayList&lt;&gt;(DecksCreator.loadBuildingDeckByEra(2));</b>
<b class="fc">&nbsp; Collections.shuffle(buildingDeck);</b>
<b class="fc">&nbsp; if(nTotem&lt;=3)</b>
&nbsp; {
<b class="fc">&nbsp; buildingCardsAllEras.set(1, new ArrayList&lt;BuildingCard&gt;(buildingDeck.subList(0, 2)));</b>
&nbsp; }
&nbsp; else
&nbsp; {
<b class="fc">&nbsp; buildingCardsAllEras.set(1, new ArrayList&lt;BuildingCard&gt;(buildingDeck.subList(0, 3)));</b>
&nbsp; }
<b class="fc">&nbsp; buildingDeck=new ArrayList&lt;&gt;(DecksCreator.loadBuildingDeckByEra(3));</b>
<b class="fc">&nbsp; Collections.shuffle(buildingDeck);</b>
<b class="fc">&nbsp; if(nTotem==2)</b>
&nbsp; {
<b class="fc">&nbsp; buildingCardsAllEras.set(2, new ArrayList&lt;BuildingCard&gt;(buildingDeck.subList(0, 3)));</b>
<b class="fc">&nbsp; }else if(nTotem==5)</b>
&nbsp; {
<b class="fc">&nbsp; buildingCardsAllEras.set(2, new ArrayList&lt;BuildingCard&gt;(buildingDeck.subList(0, 5)));</b>
&nbsp; }
&nbsp; else {
<b class="fc">&nbsp; buildingCardsAllEras.set(2, new ArrayList&lt;BuildingCard&gt;(buildingDeck.subList(0, 4)));</b>
&nbsp; }
&nbsp;
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Creates the tribeDeck. Loads the cards from each era, shuffle them, and then combine them in the final deck.
&nbsp; * In the end, two special events (Sustenance and ShamanicRitual) are added.
&nbsp; *
&nbsp; * @param nPlayers the number of players.
&nbsp; * @return a queue containing the cards in this order:
&nbsp; * - Era 1.
&nbsp; * - Era 2.
&nbsp; * - Era 3.
&nbsp; * - Special events.
&nbsp; */
&nbsp; private Queue&lt;TribeCard&gt; generateTribeDeck(int nPlayers) {
<b class="fc">&nbsp; ArrayList&lt;TribeCard&gt; era1= DecksCreator.loadTribeDeckByEra(1).stream().filter(x-&gt;x.getNMin()&lt;=nPlayers).collect(Collectors.toCollection(ArrayList::new));</b>
<b class="fc">&nbsp; ArrayList&lt;TribeCard&gt; era2= DecksCreator.loadTribeDeckByEra(2).stream().filter(x-&gt;x.getNMin()&lt;=nPlayers).collect(Collectors.toCollection(ArrayList::new));</b>
<b class="fc">&nbsp; ArrayList&lt;TribeCard&gt; era3= DecksCreator.loadTribeDeckByEra(3).stream().filter(x-&gt;x.getNMin()&lt;=nPlayers).collect(Collectors.toCollection(ArrayList::new));</b>
<b class="fc">&nbsp; Collections.shuffle(era1);</b>
<b class="fc">&nbsp; Collections.shuffle(era2);</b>
<b class="fc">&nbsp; Collections.shuffle(era3);</b>
&nbsp;
<b class="fc">&nbsp; Queue&lt;TribeCard&gt; tribeDeck_temp=new LinkedList&lt;&gt;();</b>
<b class="fc">&nbsp; tribeDeck_temp.addAll(era1);</b>
<b class="fc">&nbsp; tribeDeck_temp.addAll(era2);</b>
<b class="fc">&nbsp; tribeDeck_temp.addAll(era3);</b>
<b class="fc">&nbsp; tribeDeck_temp.add(new Sustenance(&quot;095&quot;,3,3));</b>
<b class="fc">&nbsp; tribeDeck_temp.add(new ShamanicRitual(&quot;096&quot;,3,15,7));</b>
<b class="fc">&nbsp; return tribeDeck_temp;</b>
&nbsp; }
&nbsp;
&nbsp; /** @return the queue of events cards from the lower list that need to be activated */
&nbsp; public Queue&lt;EventCard&gt; getPendingEvents(){
<b class="fc">&nbsp; return lowerListTribe.stream().filter(TribeCard::isEventCard).map(x-&gt;(EventCard)x).collect(Collectors.toCollection(LinkedList::new));</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Take the selected card from the upper tribe list of the board.
&nbsp; *
&nbsp; * @param tribeCard is the card to remove.
&nbsp; * @return true if the card is succesfully removed.
&nbsp; */
&nbsp; public boolean removeUpperTribeCard(TribeCard tribeCard) {
<b class="fc">&nbsp; return upperListTribe.remove(tribeCard);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Take the selected card from the lower tribe list of the board.
&nbsp; *
&nbsp; * @param tribeCard is the card to remove.
&nbsp; * @return true if succeed in removing the card.
&nbsp; */
&nbsp; public boolean removeLowerTribeCard(TribeCard tribeCard) {
<b class="fc">&nbsp; return lowerListTribe.remove(tribeCard);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Take the selected card from the upper building list of the board.
&nbsp; *
&nbsp; * @param buildingCard is the card to remove.
&nbsp; * @return true if succeed in removing the card.
&nbsp; */
&nbsp; public boolean removeUpperBuildingCard(BuildingCard buildingCard) {
<b class="fc">&nbsp; return upperListBuilding.remove(buildingCard);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Take the selected card from the lower building list of the board.
&nbsp; *
&nbsp; * @param buildingCard is the card to remove.
&nbsp; * @return true if succeed in removing the card.
&nbsp; */
&nbsp; public boolean removeLowerBuildingCard(BuildingCard buildingCard) {
<b class="fc">&nbsp; return lowerListBuilding.remove(buildingCard);</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Goes to the next round.
&nbsp; * - Clear the lower tribe row.
&nbsp; * - Moves the upper tribe row to the lower one.
&nbsp; * - Populate the upper tribe row.
&nbsp; *
&nbsp; * @return the current era after moving to the next round.
&nbsp; */
&nbsp; public int nextRound() {
<b class="fc">&nbsp; lowerListTribe.clear();</b>
<b class="fc">&nbsp; lowerListTribe.addAll(upperListTribe);</b>
<b class="fc">&nbsp; upperListTribe.clear();</b>
&nbsp;
<b class="fc">&nbsp; for(int i=0;i&lt;nTotem+4;i++)</b>
&nbsp; {
<b class="pc">&nbsp; if (tribeDeck.isEmpty()) break;</b>
<b class="fc">&nbsp; TribeCard tempCard = tribeDeck.remove();</b>
<b class="fc">&nbsp; if(tempCard.getEra()!=era)</b>
&nbsp; {
<b class="fc">&nbsp; nextEra();</b>
&nbsp; }
<b class="fc">&nbsp; upperListTribe.add(tempCard);</b>
&nbsp; }
&nbsp;
<b class="fc">&nbsp; return era;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Changes the era of the game:
&nbsp; * - Increase the era attribute.
&nbsp; * - Clear the lower building list and replace it with the upper building list.
&nbsp; * - Repopulate the upper building list.
&nbsp; */
&nbsp; private void nextEra() {
<b class="fc">&nbsp; era=era+1;</b>
<b class="fc">&nbsp; lowerListBuilding.clear();</b>
<b class="fc">&nbsp; lowerListBuilding.addAll(upperListBuilding);</b>
<b class="fc">&nbsp; upperListBuilding.clear();</b>
&nbsp;
<b class="fc">&nbsp; if(era==2)</b>
&nbsp; {
<b class="fc">&nbsp; upperListBuilding.addAll(buildingCardsAllEras.get(1));</b>
&nbsp; }
&nbsp; else
&nbsp; {
<b class="fc">&nbsp; upperListBuilding.addAll(buildingCardsAllEras.get(2));</b>
&nbsp; }
&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-14 21:53</div>
</div>
</body>
</html>
@@ -0,0 +1,339 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > CurrentState</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.GamePackage</a>
</div>
<h1>Coverage Summary for Class: CurrentState (it.polimi.ingsw.gc14.Model.GamePackage)</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">CurrentState</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
93.3%
</span>
<span class="absValue">
(14/15)
</span>
</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(2/2)
</span>
</td>
<td class="coverageStat">
<span class="percent">
64.3%
</span>
<span class="absValue">
(27/42)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.GamePackage;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Model.Player;
&nbsp;import it.polimi.ingsw.gc14.Model.Slot;
&nbsp;import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
&nbsp;import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
&nbsp;import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
&nbsp;
&nbsp;import java.io.Serializable;
&nbsp;import java.util.ArrayList;
&nbsp;import java.util.List;
&nbsp;
&nbsp;/**
&nbsp; * Represents the current state of the game.
&nbsp; * A CurrentState object stores the current player, slot, era, round,
&nbsp; * remaining upper and lower cards, and the current game stage.
&nbsp; */
&nbsp;public class CurrentState implements Serializable {
&nbsp; // region Getters
&nbsp;
&nbsp; /**
&nbsp; * The current player associated with the game state.
&nbsp; */
&nbsp; private Player player;
&nbsp;
&nbsp; /**
&nbsp; * Returns the current player.
&nbsp; *
&nbsp; * @return the current player.
&nbsp; */
&nbsp; public Player getCurrentPlayer(){
<b class="fc">&nbsp; return player;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * The current slot associated with the game state.
&nbsp; */
&nbsp; private Slot slot;
&nbsp;
&nbsp; /**
&nbsp; * Returns the current slot.
&nbsp; *
&nbsp; * @return the current slot.
&nbsp; */
&nbsp; public Slot getSlot(){
<b class="fc">&nbsp; return slot;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * The current era of the game.
&nbsp; */
&nbsp; private int era;
&nbsp;
&nbsp; /**
&nbsp; * Returns the current era of the game.
&nbsp; *
&nbsp; * @return the current era of the game.
&nbsp; */
&nbsp; public int getEra(){
<b class="fc">&nbsp; return era;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * The current round of the game.
&nbsp; */
&nbsp; private int round;
&nbsp;
&nbsp; /**
&nbsp; * Returns the current round of the game.
&nbsp; *
&nbsp; * @return the current round of the game.
&nbsp; */
&nbsp; public int getRound(){
<b class="fc">&nbsp; return round;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * The number of upper cards currently available.
&nbsp; */
&nbsp; private int nUpper;
&nbsp;
&nbsp; /**
&nbsp; * Returns the number of upper cards currently available.
&nbsp; *
&nbsp; * @return the number of upper cards currently available.
&nbsp; */
&nbsp; public int getNUpper(){
<b class="fc">&nbsp; return nUpper;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * The number of lower cards currently available.
&nbsp; */
&nbsp; private int nLower;
&nbsp;
&nbsp; /**
&nbsp; * Returns the number of lower cards currently available.
&nbsp; *
&nbsp; * @return the number of lower cards currently available.
&nbsp; */
&nbsp; public int getNLower(){
<b class="fc">&nbsp; return nLower;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * The current stage of the game.
&nbsp; */
&nbsp; private GameStages gameStage;
&nbsp;
&nbsp; /**
&nbsp; * Returns the current stage of the game.
&nbsp; *
&nbsp; * @return the current stage of the game.
&nbsp; */
&nbsp; public GameStages getGameStage(){
<b class="fc">&nbsp; return gameStage;</b>
&nbsp; }
&nbsp;
&nbsp; // endregion getters
&nbsp;
&nbsp; // region Setters
&nbsp;
&nbsp; /**
&nbsp; * Increments the current era by 1.
&nbsp; */
&nbsp; public void eraUpdate(){
<b class="fc">&nbsp; era++;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Increments the current round by 1.
&nbsp; */
&nbsp; public void roundUpdate(){
<b class="fc">&nbsp; round++;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Decrements the number of upper cards by 1.
&nbsp; */
&nbsp; public void upperDrawn(){
<b class="fc">&nbsp; nUpper--;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Decrements the number of lower cards by 1.
&nbsp; */
&nbsp; public void lowerDrawn(){
<b class="fc">&nbsp; nLower--;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Updates the current game stage.
&nbsp; *
&nbsp; * @param stage the new game stage.
&nbsp; */
&nbsp; public void gameStageUpdate(GameStages stage){
<b class="fc">&nbsp; this.gameStage = stage;</b>
&nbsp; }
&nbsp; // endregion setters
&nbsp;
&nbsp; // region Constructors
&nbsp;
&nbsp; /**
&nbsp; * Creates a new CurrentState object with default initial values.
&nbsp; * The initial player and slot are {@code null}, the era and round are set to 1,
&nbsp; * the number of upper and lower cards is set to 0, and the game stage is set to {@code WAITING}.
&nbsp; */
<b class="fc">&nbsp; public CurrentState(){</b>
<b class="fc">&nbsp; this.player = null;</b>
<b class="fc">&nbsp; this.slot = null;</b>
<b class="fc">&nbsp; this.era = 1;</b>
<b class="fc">&nbsp; this.round = 1;</b>
<b class="fc">&nbsp; this.nUpper = 0;</b>
<b class="fc">&nbsp; this.nLower = 0;</b>
<b class="fc">&nbsp; this.gameStage = GameStages.WAITING;</b>
&nbsp; }
&nbsp; // endregion constructors
&nbsp;
&nbsp; // region Functions
&nbsp;
&nbsp; /**
&nbsp; * Updates the current player, slot, and available draws.
&nbsp; * If {@code slot} is {@code null}, both {@link #nUpper} and {@link #nLower} are reset to 0.
&nbsp; * Otherwise they are set from the slot&#39;s values.
&nbsp; *
&nbsp; * @param player the new current player.
&nbsp; * @param slot the new current slot, or {@code null} when no slot is active.
&nbsp; */
&nbsp; public void playerUpdate(Player player, Slot slot){
<b class="fc">&nbsp; this.player = player;</b>
<b class="fc">&nbsp; this.slot = slot;</b>
<b class="fc">&nbsp; if(slot == null){</b>
<b class="fc">&nbsp; this.nUpper = 0;</b>
<b class="fc">&nbsp; this.nLower = 0;</b>
&nbsp; }
&nbsp; else{
<b class="fc">&nbsp; this.nUpper = slot.getNUpper();</b>
<b class="fc">&nbsp; this.nLower = slot.getNLower();</b>
&nbsp; }
&nbsp;
&nbsp; }
&nbsp;
&nbsp; // TODO
&nbsp; @Override
&nbsp; public String toString(){
<b class="nc">&nbsp; var table= new AsciiTable(BorderStyle.ROUNDED,4);</b>
<b class="nc">&nbsp; List&lt;String&gt;header= new ArrayList&lt;&gt;();</b>
<b class="nc">&nbsp; header.add(&quot;Player&quot;);</b>
<b class="nc">&nbsp; header.add(&quot;Round&quot;);</b>
<b class="nc">&nbsp; header.add(&quot;Era&quot;);</b>
<b class="nc">&nbsp; header.add(&quot;GameStage&quot;);</b>
<b class="nc">&nbsp; table.addRow(header);</b>
<b class="nc">&nbsp; table.addSeparator();</b>
<b class="nc">&nbsp; List&lt;String&gt;values= new ArrayList&lt;&gt;();</b>
<b class="nc">&nbsp; values.add(player.getUserName());</b>
<b class="nc">&nbsp; values.add(Integer.toString(round));</b>
<b class="nc">&nbsp; values.add(Integer.toString(era));</b>
<b class="nc">&nbsp; values.add(gameStage.toString());</b>
<b class="nc">&nbsp; table.addRow(values);</b>
<b class="nc">&nbsp; return table.build();</b>
&nbsp; }
&nbsp; // endregion functions
&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-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 > GameStages</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.GamePackage</a>
</div>
<h1>Coverage Summary for Class: GameStages (it.polimi.ingsw.gc14.Model.GamePackage)</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">GameStages</td>
<td class="coverageStat">
<span class="percent">
100%
</span>
<span class="absValue">
(1/1)
</span>
</td>
<td class="coverageStat">
<span class="percent">
75%
</span>
<span class="absValue">
(3/4)
</span>
</td>
<td class="coverageStat">
<span class="percent">
91.7%
</span>
<span class="absValue">
(11/12)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Model.GamePackage;
&nbsp;
&nbsp;/**
&nbsp; * Represents the possible stages of a game.
&nbsp; */
<b class="fc">&nbsp;public enum GameStages {</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which the game is waiting for players to join.
&nbsp; */
<b class="fc">&nbsp; WAITING(&quot;Waiting&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which players choose their totems.
&nbsp; */
<b class="fc">&nbsp; TOTEM_CHOICE(&quot;Totem&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which players select their action slots.
&nbsp; */
<b class="fc">&nbsp; SLOT_CHOICE(&quot;Slot&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which the mandatory actions associated with the chosen slots are resolved.
&nbsp; */
<b class="fc">&nbsp; RES_ACTIONS(&quot;Actions&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which an optional card effect can be resolved.
&nbsp; */
<b class="fc">&nbsp; OPT_CARD_E(&quot;Card Effect&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which an event card is being resolved.
&nbsp; */
<b class="fc">&nbsp; RES_EVENT(&quot;Event&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage in which end-of-game scoring and ranking are computed.
&nbsp; */
<b class="fc">&nbsp; ENDING(&quot;Ending&quot;),</b>
&nbsp;
&nbsp; /**
&nbsp; * Stage indicating that the game has ended.
&nbsp; */
<b class="fc">&nbsp; ENDED(&quot;Ended&quot;);</b>
&nbsp;
&nbsp; /** The human-readable name of this stage, used in {@link #toString()}. */
&nbsp; private final String displayName;
&nbsp;
&nbsp; /**
&nbsp; * Constructs a {@code GameStages} value with the given display name.
&nbsp; *
&nbsp; * @param displayName the human-readable label for this stage
&nbsp; */
<b class="fc">&nbsp; GameStages(String displayName) {</b>
<b class="fc">&nbsp; this.displayName = displayName;</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Returns the human-readable name of this stage.
&nbsp; *
&nbsp; * @return the display name (e.g. {@code &quot;Slot&quot;} for {@code SLOT_CHOICE})
&nbsp; */
&nbsp; @Override
&nbsp; public String toString() {
<b class="nc">&nbsp; return displayName;</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-14 21:53</div>
</div>
</body>
</html>