Add: Added Coverage Screenshots And htlmReport.
This commit is contained in:
@@ -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"> package it.polimi.ingsw.gc14.Model.GamePackage;
|
||||
|
||||
import it.polimi.ingsw.gc14.Model.Player;
|
||||
import it.polimi.ingsw.gc14.Model.Slot;
|
||||
import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
|
||||
import it.polimi.ingsw.gc14.View.TUI.AsciiTable;
|
||||
import it.polimi.ingsw.gc14.View.TUI.BorderStyle;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents the current state of the game.
|
||||
* A CurrentState object stores the current player, slot, era, round,
|
||||
* remaining upper and lower cards, and the current game stage.
|
||||
*/
|
||||
public class CurrentState implements Serializable {
|
||||
// region Getters
|
||||
|
||||
/**
|
||||
* The current player associated with the game state.
|
||||
*/
|
||||
private Player player;
|
||||
|
||||
/**
|
||||
* Returns the current player.
|
||||
*
|
||||
* @return the current player.
|
||||
*/
|
||||
public Player getCurrentPlayer(){
|
||||
<b class="fc"> return player;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* The current slot associated with the game state.
|
||||
*/
|
||||
private Slot slot;
|
||||
|
||||
/**
|
||||
* Returns the current slot.
|
||||
*
|
||||
* @return the current slot.
|
||||
*/
|
||||
public Slot getSlot(){
|
||||
<b class="fc"> return slot;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* The current era of the game.
|
||||
*/
|
||||
private int era;
|
||||
|
||||
/**
|
||||
* Returns the current era of the game.
|
||||
*
|
||||
* @return the current era of the game.
|
||||
*/
|
||||
public int getEra(){
|
||||
<b class="fc"> return era;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* The current round of the game.
|
||||
*/
|
||||
private int round;
|
||||
|
||||
/**
|
||||
* Returns the current round of the game.
|
||||
*
|
||||
* @return the current round of the game.
|
||||
*/
|
||||
public int getRound(){
|
||||
<b class="fc"> return round;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of upper cards currently available.
|
||||
*/
|
||||
private int nUpper;
|
||||
|
||||
/**
|
||||
* Returns the number of upper cards currently available.
|
||||
*
|
||||
* @return the number of upper cards currently available.
|
||||
*/
|
||||
public int getNUpper(){
|
||||
<b class="fc"> return nUpper;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of lower cards currently available.
|
||||
*/
|
||||
private int nLower;
|
||||
|
||||
/**
|
||||
* Returns the number of lower cards currently available.
|
||||
*
|
||||
* @return the number of lower cards currently available.
|
||||
*/
|
||||
public int getNLower(){
|
||||
<b class="fc"> return nLower;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* The current stage of the game.
|
||||
*/
|
||||
private GameStages gameStage;
|
||||
|
||||
/**
|
||||
* Returns the current stage of the game.
|
||||
*
|
||||
* @return the current stage of the game.
|
||||
*/
|
||||
public GameStages getGameStage(){
|
||||
<b class="fc"> return gameStage;</b>
|
||||
}
|
||||
|
||||
// endregion getters
|
||||
|
||||
// region Setters
|
||||
|
||||
/**
|
||||
* Increments the current era by 1.
|
||||
*/
|
||||
public void eraUpdate(){
|
||||
<b class="fc"> era++;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Increments the current round by 1.
|
||||
*/
|
||||
public void roundUpdate(){
|
||||
<b class="fc"> round++;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the number of upper cards by 1.
|
||||
*/
|
||||
public void upperDrawn(){
|
||||
<b class="fc"> nUpper--;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the number of lower cards by 1.
|
||||
*/
|
||||
public void lowerDrawn(){
|
||||
<b class="fc"> nLower--;</b>
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the current game stage.
|
||||
*
|
||||
* @param stage the new game stage.
|
||||
*/
|
||||
public void gameStageUpdate(GameStages stage){
|
||||
<b class="fc"> this.gameStage = stage;</b>
|
||||
}
|
||||
// endregion setters
|
||||
|
||||
// region Constructors
|
||||
|
||||
/**
|
||||
* Creates a new CurrentState object with default initial values.
|
||||
* The initial player and slot are {@code null}, the era and round are set to 1,
|
||||
* the number of upper and lower cards is set to 0, and the game stage is set to {@code WAITING}.
|
||||
*/
|
||||
<b class="fc"> public CurrentState(){</b>
|
||||
<b class="fc"> this.player = null;</b>
|
||||
<b class="fc"> this.slot = null;</b>
|
||||
<b class="fc"> this.era = 1;</b>
|
||||
<b class="fc"> this.round = 1;</b>
|
||||
<b class="fc"> this.nUpper = 0;</b>
|
||||
<b class="fc"> this.nLower = 0;</b>
|
||||
<b class="fc"> this.gameStage = GameStages.WAITING;</b>
|
||||
}
|
||||
// endregion constructors
|
||||
|
||||
// region Functions
|
||||
|
||||
/**
|
||||
* Updates the current player, slot, and available draws.
|
||||
* If {@code slot} is {@code null}, both {@link #nUpper} and {@link #nLower} are reset to 0.
|
||||
* Otherwise they are set from the slot's values.
|
||||
*
|
||||
* @param player the new current player.
|
||||
* @param slot the new current slot, or {@code null} when no slot is active.
|
||||
*/
|
||||
public void playerUpdate(Player player, Slot slot){
|
||||
<b class="fc"> this.player = player;</b>
|
||||
<b class="fc"> this.slot = slot;</b>
|
||||
<b class="fc"> if(slot == null){</b>
|
||||
<b class="fc"> this.nUpper = 0;</b>
|
||||
<b class="fc"> this.nLower = 0;</b>
|
||||
}
|
||||
else{
|
||||
<b class="fc"> this.nUpper = slot.getNUpper();</b>
|
||||
<b class="fc"> this.nLower = slot.getNLower();</b>
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// TODO
|
||||
@Override
|
||||
public String toString(){
|
||||
<b class="nc"> var table= new AsciiTable(BorderStyle.ROUNDED,4);</b>
|
||||
<b class="nc"> List<String>header= new ArrayList<>();</b>
|
||||
<b class="nc"> header.add("Player");</b>
|
||||
<b class="nc"> header.add("Round");</b>
|
||||
<b class="nc"> header.add("Era");</b>
|
||||
<b class="nc"> header.add("GameStage");</b>
|
||||
<b class="nc"> table.addRow(header);</b>
|
||||
<b class="nc"> table.addSeparator();</b>
|
||||
<b class="nc"> List<String>values= new ArrayList<>();</b>
|
||||
<b class="nc"> values.add(player.getUserName());</b>
|
||||
<b class="nc"> values.add(Integer.toString(round));</b>
|
||||
<b class="nc"> values.add(Integer.toString(era));</b>
|
||||
<b class="nc"> values.add(gameStage.toString());</b>
|
||||
<b class="nc"> table.addRow(values);</b>
|
||||
<b class="nc"> return table.build();</b>
|
||||
}
|
||||
// endregion functions
|
||||
}
|
||||
</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