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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name sortedAsc
">
<a href="index_SORT_BY_NAME_DESC.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_BLOCK.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat sortedAsc
">
<a href="index_SORT_BY_BLOCK_DESC.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_BLOCK_DESC.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat sortedDesc
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_CLASS.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat sortedAsc
">
<a href="index_SORT_BY_CLASS_DESC.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_CLASS_DESC.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat sortedDesc
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_LINE.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat sortedAsc
">
<a href="index_SORT_BY_LINE_DESC.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_LINE_DESC.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat sortedDesc
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_METHOD.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat sortedAsc
">
<a href="index_SORT_BY_METHOD_DESC.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_METHOD_DESC.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat sortedDesc
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
</table>
</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,202 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > it.polimi.ingsw.gc14.Network.RMI.Server</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_SORT_BY_NAME_DESC.html">all classes</a>
<span class="separator">|</span>
it.polimi.ingsw.gc14.Network.RMI.Server</div>
<h1>Coverage Summary for Package: it.polimi.ingsw.gc14.Network.RMI.Server</h1>
<table class="coverageStats">
<tr>
<th class="name">Package</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">it.polimi.ingsw.gc14.Network.RMI.Server</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/23)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/36)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/113)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<table class="coverageStats">
<tr>
<th class="name sortedDesc
">
<a href="index.html">Class</a> </th>
<th class="coverageStat
">
<a href="index_SORT_BY_CLASS.html">Class, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_METHOD.html">Method, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_BLOCK.html">Branch, %</a>
</th>
<th class="coverageStat
">
<a href="index_SORT_BY_LINE.html">Line, %</a>
</th>
</tr>
<tr>
<td class="name"><a href="sources/source-2.html">RMIServer</a></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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
<tr>
<td class="name"><a href="sources/source-1.html">RMIHeartbeat</a></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/6)
</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/25)
</span>
</td>
</tr>
</table>
</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,219 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > RMIHeartbeat</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.RMI.Server</a>
</div>
<h1>Coverage Summary for Class: RMIHeartbeat (it.polimi.ingsw.gc14.Network.RMI.Server)</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">RMIHeartbeat</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/6)
</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/25)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Network.RMI.Server;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.LimitedMap;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkEvent;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkConfig;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkEvents.DisconnectedPlayer;
&nbsp;import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback;
&nbsp;
&nbsp;import java.util.Map;
&nbsp;import java.util.concurrent.*;
&nbsp;
&nbsp;/**
&nbsp; * Server-side heartbeat watchdog for a single RMI client.
&nbsp; *
&nbsp; * &lt;p&gt;Mirrors {@code HeartbeatHandler} used in the TCP stack, but adapted for RMI:
&nbsp; * instead of reading raw bytes from a dedicated socket, it relies on {@link #receivePing()}
&nbsp; * being called by {@link RMIServer#ping(String)} every time the client sends a ping.
&nbsp; *
&nbsp; * &lt;p&gt;If no ping is received within {@value NetworkConfig#SILENCE_THRESHOLD_MS} ms, the player is
&nbsp; * considered disconnected and {@link #disconnect()} is invoked, which:
&nbsp; * &lt;ul&gt;
&nbsp; * &lt;li&gt;stops the watchdog;&lt;/li&gt;
&nbsp; * &lt;li&gt;marks the player as offline in {@code playerList};&lt;/li&gt;
&nbsp; * &lt;li&gt;removes the callback from {@code clients};&lt;/li&gt;
&nbsp; * &lt;li&gt;adds a {@link DisconnectedPlayer} event to the action queue.&lt;/li&gt;
&nbsp; * &lt;/ul&gt;
&nbsp; */
&nbsp;public class RMIHeartbeat {
&nbsp;
<b class="nc">&nbsp; private String username = &quot;&quot;;</b>
&nbsp; private final LimitedMap&lt;String, Boolean&gt; playerList;
&nbsp; private final Map&lt;String, IClientCallback&gt; clients;
&nbsp; private final BlockingQueue&lt;NetworkEvent&gt; actionQueue;
&nbsp;
&nbsp; /** Last time a ping was received from this client. */
<b class="nc">&nbsp; private volatile long lastPingTime = System.currentTimeMillis();</b>
<b class="nc">&nbsp; private volatile boolean running = true;</b>
&nbsp;
<b class="nc">&nbsp; private final ScheduledExecutorService watchdog =</b>
<b class="nc">&nbsp; Executors.newSingleThreadScheduledExecutor(r -&gt; {</b>
<b class="nc">&nbsp; Thread t = new Thread(r, &quot;rmi-watchdog-&quot; + username);</b>
<b class="nc">&nbsp; t.setDaemon(true);</b>
<b class="nc">&nbsp; return t;</b>
&nbsp; });
&nbsp;
&nbsp; /**
&nbsp; * Constructs an RMI heartbeat handler for the specified client.
&nbsp; *
&nbsp; * @param username the username of the client monitored by the heartbeat.
&nbsp; * @param playerList the map storing the connection status of the players.
&nbsp; * @param clients the collection of currently registered RMI clients.
&nbsp; * @param actionQueue the queue containing network events to be processed.
&nbsp; */
&nbsp; public RMIHeartbeat(
&nbsp; String username,
&nbsp; LimitedMap&lt;String, Boolean&gt; playerList,
&nbsp; Map&lt;String, IClientCallback&gt; clients,
<b class="nc">&nbsp; BlockingQueue&lt;NetworkEvent&gt; actionQueue) {</b>
&nbsp;
<b class="nc">&nbsp; this.username = username;</b>
<b class="nc">&nbsp; this.playerList = playerList;</b>
<b class="nc">&nbsp; this.clients = clients;</b>
<b class="nc">&nbsp; this.actionQueue = actionQueue;</b>
&nbsp; }
&nbsp;
&nbsp; /** Called by {@link RMIServer} whenever it starts tracking this player. */
&nbsp; public void start() {
<b class="nc">&nbsp; watchdog.scheduleAtFixedRate(() -&gt; {</b>
<b class="nc">&nbsp; if (System.currentTimeMillis() - lastPingTime &gt; NetworkConfig.SILENCE_THRESHOLD_MS) {</b>
<b class="nc">&nbsp; System.out.println(&quot;RMI heartbeat timeout: &quot; + username);</b>
<b class="nc">&nbsp; disconnect();</b>
&nbsp; }
&nbsp; }, 1, 1, TimeUnit.SECONDS);
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Called by {@link RMIServer#ping(String)} each time the client pings.
&nbsp; * Resets the silence timer — mirrors writing {@code lastReceivedTime} in
&nbsp; * {@code HeartbeatHandler}.
&nbsp; */
&nbsp; public void receivePing() {
<b class="nc">&nbsp; lastPingTime = System.currentTimeMillis();</b>
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Disconnects the monitored RMI client.
&nbsp; *
&nbsp; * &lt;p&gt;The heartbeat handler is stopped, the player is marked as offline,
&nbsp; * the associated RMI callback is removed, and a disconnection event is
&nbsp; * added to the action queue for server-side processing.
&nbsp; */
&nbsp; public void disconnect() {
<b class="nc">&nbsp; if (!running) return;</b>
<b class="nc">&nbsp; running = false;</b>
<b class="nc">&nbsp; watchdog.shutdownNow();</b>
&nbsp;
<b class="nc">&nbsp; playerList.put(username, false);</b>
&nbsp;
<b class="nc">&nbsp; clients.remove(username);</b>
<b class="nc">&nbsp; actionQueue.add(new DisconnectedPlayer(username));</b>
<b class="nc">&nbsp; System.out.println(&quot;RMI disconnected: &quot; + username);</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>
@@ -0,0 +1,490 @@
<!DOCTYPE html>
<html id="htmlId">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Coverage Report > RMIServer</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.RMI.Server</a>
</div>
<h1>Coverage Summary for Class: RMIServer (it.polimi.ingsw.gc14.Network.RMI.Server)</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">RMIServer</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/17)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/32)
</span>
</td>
<td class="coverageStat">
<span class="percent">
0%
</span>
<span class="absValue">
(0/88)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package it.polimi.ingsw.gc14.Network.RMI.Server;
&nbsp;
&nbsp;import it.polimi.ingsw.gc14.Controller.GameController;
&nbsp;import it.polimi.ingsw.gc14.ErrorType;
&nbsp;import it.polimi.ingsw.gc14.LimitedMap;
&nbsp;import it.polimi.ingsw.gc14.Model.Game;
&nbsp;import it.polimi.ingsw.gc14.Model.GamePackage.GameStages;
&nbsp;import it.polimi.ingsw.gc14.Model.MiniModel;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkConfig;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkEvent;
&nbsp;import it.polimi.ingsw.gc14.Network.NetworkEvents.*;
&nbsp;import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback;
&nbsp;import it.polimi.ingsw.gc14.Network.RMI.Common.IGameServer;
&nbsp;
&nbsp;import java.rmi.RemoteException;
&nbsp;import java.rmi.registry.LocateRegistry;
&nbsp;import java.rmi.registry.Registry;
&nbsp;import java.rmi.server.UnicastRemoteObject;
&nbsp;import java.util.ArrayList;
&nbsp;import java.util.Map;
&nbsp;import java.util.concurrent.BlockingQueue;
&nbsp;import java.util.concurrent.ConcurrentHashMap;
&nbsp;
&nbsp;import java.rmi.*;
&nbsp;import java.util.stream.Collectors;
&nbsp;
&nbsp;
&nbsp;/**
&nbsp; * RMI server responsible for handling remote client connections,
&nbsp; * receiving player actions, and propagating game updates.
&nbsp; *
&nbsp; * &lt;p&gt;The server manages player registration, reconnection handling,
&nbsp; * heartbeat monitoring, and the forwarding of client requests to the
&nbsp; * shared network event queue.
&nbsp; */
&nbsp;public class RMIServer extends UnicastRemoteObject implements IGameServer {
&nbsp; private final String host;
&nbsp; private final GameController controller;
&nbsp; private Registry registry;
&nbsp; private final int nPort;
&nbsp;
&nbsp; /** username → callback */
<b class="nc">&nbsp; private final Map&lt;String, IClientCallback&gt; clients = new ConcurrentHashMap&lt;&gt;();</b>
&nbsp;
&nbsp; /**
&nbsp; * username → watchdog.
&nbsp; * One watchdog per connected player, mirrors {@code pendingHeartbeat} / per-socket
&nbsp; * HeartbeatHandler in the TCP stack.
&nbsp; */
<b class="nc">&nbsp; private final Map&lt;String, RMIHeartbeat&gt; watchdogs = new ConcurrentHashMap&lt;&gt;();</b>
&nbsp;
&nbsp; private final BlockingQueue&lt;NetworkEvent&gt; actionQueue;
&nbsp; private final LimitedMap&lt;String, Boolean&gt; playerList;
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Constructs an RMI server with the required game and network components.
&nbsp; *
&nbsp; * @param controller the game controller used to manage the game logic.
&nbsp; * @param nPort the port used by the RMI registry.
&nbsp; * @param actionQueue the queue containing incoming network events.
&nbsp; * @param playerList the map storing the connection status of the players.
&nbsp; * @param host the hostname or IP address exposed by the RMI server.
&nbsp; * @throws RemoteException if the remote object cannot be exported.
&nbsp; */
&nbsp; public RMIServer(GameController controller, int nPort,
&nbsp; BlockingQueue&lt;NetworkEvent&gt; actionQueue,
&nbsp; LimitedMap&lt;String, Boolean&gt; playerList,
<b class="nc">&nbsp; String host) throws RemoteException {</b>
<b class="nc">&nbsp; this.controller = controller;</b>
<b class="nc">&nbsp; this.nPort = nPort;</b>
<b class="nc">&nbsp; this.actionQueue = actionQueue;</b>
<b class="nc">&nbsp; this.playerList = playerList;</b>
<b class="nc">&nbsp; this.host = host;</b>
&nbsp; }
&nbsp;
&nbsp; // -------------------------------------------------------------------------
&nbsp; // Join
&nbsp; // -------------------------------------------------------------------------
&nbsp;
&nbsp; /**
&nbsp; * {@inheritDoc}
&nbsp; *
&nbsp; * &lt;p&gt;After a successful join an {@link RMIHeartbeat} watchdog is created and
&nbsp; * started for the new player — mirrors creating a {@code HeartbeatHandler} in
&nbsp; * {@code TCPServer.acceptHeartbeat()}.
&nbsp; *
&nbsp; * @return {@code null} on success; an {@link it.polimi.ingsw.gc14.ErrorType} value on rejection.
&nbsp; */
&nbsp; @Override
&nbsp; public ErrorType joinGame(String username, int preferredInt, IClientCallback callback)
&nbsp; throws RemoteException {
<b class="nc">&nbsp; if (preferredInt &lt; NetworkConfig.MIN_PLAYERS || preferredInt &gt; NetworkConfig.MAX_PLAYERS)</b>
<b class="nc">&nbsp; return ErrorType.WRONG_PLAYER_NUMBER;</b>
&nbsp;
<b class="nc">&nbsp; synchronized (controller) {</b>
&nbsp;
<b class="nc">&nbsp; if (playerList.isEmpty() &amp;&amp; controller.getModel()==null) {</b>
<b class="nc">&nbsp; controller.setModel(new Game(preferredInt));</b>
<b class="nc">&nbsp; playerList.setLimit(preferredInt);</b>
<b class="nc">&nbsp; System.out.println(&quot;Game Created With :&quot;+preferredInt+&quot; Players&quot;);</b>
&nbsp; }
<b class="nc">&nbsp; if(controller.getModel().getCurrentState().getGameStage()!= GameStages.WAITING ) {</b>
<b class="nc">&nbsp; if (controller.getModel().getPlayers().stream().noneMatch(p -&gt; p.getUserName().equals(username))|| controller.getModel().getCurrentState().getGameStage()==GameStages.ENDED) {</b>
<b class="nc">&nbsp; return ErrorType.GAME_ALREADY_STARTED;</b>
&nbsp; }
&nbsp; }
&nbsp; else {
<b class="nc">&nbsp; if (controller.addPlayer(username)) {</b>
<b class="nc">&nbsp; clients.put(username, callback);</b>
<b class="nc">&nbsp; playerList.put(username, true);</b>
<b class="nc">&nbsp; startWatchdog(username);</b>
<b class="nc">&nbsp; System.out.println(&quot;Accepted player: &quot; + username);</b>
<b class="nc">&nbsp; return null;</b>
&nbsp; } else {
<b class="nc">&nbsp; return ErrorType.USERNAME_ALREADY_USED;</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp;
<b class="nc">&nbsp; if(!playerList.containsKey(username)){</b>
<b class="nc">&nbsp; clients.put(username, callback);</b>
<b class="nc">&nbsp; playerList.put(username, true);</b>
<b class="nc">&nbsp; startWatchdog(username);</b>
<b class="nc">&nbsp; System.out.println(&quot;(After crash)Reconnected player: &quot; + username);</b>
<b class="nc">&nbsp; return null;</b>
&nbsp; }
&nbsp; else {
<b class="nc">&nbsp; if(!playerList.get(username))</b>
&nbsp; {
<b class="nc">&nbsp; playerList.put(username, true);</b>
<b class="nc">&nbsp; clients.put(username, callback);</b>
<b class="nc">&nbsp; System.out.println(&quot;Reconnected player: &quot; + username);</b>
<b class="nc">&nbsp; startWatchdog(username);</b>
<b class="nc">&nbsp; Game game = controller.getModel();</b>
<b class="nc">&nbsp; callback.onGameInit(new MiniModel(</b>
<b class="nc">&nbsp; game.getSlotMap(), game.getOrderLogicCard(), game.getCurrentState(),</b>
<b class="nc">&nbsp; game.getPlayers(), game.getAvailableTotems(),</b>
<b class="nc">&nbsp; game.getUpperListTribeCards(), game.getLowerListTribeCards(),</b>
<b class="nc">&nbsp; game.getUpperListBuilding(), game.getLowerListBuilding(),</b>
<b class="nc">&nbsp; disconnectedUsernames(game)));</b>
<b class="nc">&nbsp; System.out.println(&quot;Model sent: &quot; + username);</b>
<b class="nc">&nbsp; actionQueue.add(new ReconnectPlayer(username));</b>
<b class="nc">&nbsp; return null;</b>
&nbsp; }
&nbsp; else
<b class="nc">&nbsp; return ErrorType.USER_ALREADY_CONNECTED;</b>
&nbsp; }
<b class="nc">&nbsp; }</b>
&nbsp; }
&nbsp;
&nbsp; // -------------------------------------------------------------------------
&nbsp; // Heartbeat — called by RMIClient every ~3 s
&nbsp; // -------------------------------------------------------------------------
&nbsp;
&nbsp; /**
&nbsp; * Receives a heartbeat ping from the client.
&nbsp; * Mirrors the server reading {@code PING} and replying {@code PONG} in
&nbsp; * {@code HeartbeatHandler.run()}.
&nbsp; *
&nbsp; * @param username the username of the pinging client.
&nbsp; */
&nbsp; @Override
&nbsp; public void ping(String username) throws RemoteException {
<b class="nc">&nbsp; RMIHeartbeat wd = watchdogs.get(username);</b>
<b class="nc">&nbsp; if (wd != null) wd.receivePing();</b>
&nbsp; }
&nbsp;
&nbsp; // -------------------------------------------------------------------------
&nbsp; // Game model propagation — keep watchdogs in sync
&nbsp; // -------------------------------------------------------------------------
&nbsp;
&nbsp; /**
&nbsp; * Notifies connected RMI clients of a new network event.
&nbsp; *
&nbsp; * &lt;p&gt;If the event does not represent an error, it is sent to all registered clients.
&nbsp; * If it represents an error, it is sent only to the client that requested the action.
&nbsp; * Communication errors are logged without interrupting the notification process.
&nbsp; *
&nbsp; * @param action the network event to send to the clients.
&nbsp; */
&nbsp; public void notifyAll(NetworkEvent action){
<b class="nc">&nbsp; for (Map.Entry&lt;String, IClientCallback&gt; entry : clients.entrySet()) {</b>
<b class="nc">&nbsp; if (!action.isError() || action.getUsername().equals(entry.getKey())) {</b>
&nbsp; try{
<b class="nc">&nbsp; entry.getValue().onAction(action);</b>
&nbsp; }
&nbsp; catch (RemoteException e)
&nbsp; {
<b class="nc">&nbsp; System.out.println(&quot;Remote exception: Exception during action sending attempt &quot; + e.getMessage());</b>
&nbsp; }
&nbsp; }
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Notifies all connected RMI clients of a new game model.
&nbsp; *
&nbsp; * &lt;p&gt;The updated mini model is sent to each registered client callback.
&nbsp; * If a communication error occurs for a client, the exception is logged
&nbsp; * without interrupting the notification of the remaining clients.
&nbsp; *
&nbsp; * @param model the updated mini model to send to the connected clients.
&nbsp; */
&nbsp; public void notifyAll(MiniModel model) {
<b class="nc">&nbsp; for (IClientCallback cb : clients.values()) {</b>
&nbsp; try{
<b class="nc">&nbsp; cb.onGameInit(model);</b>
&nbsp; }
&nbsp; catch (RemoteException e)
&nbsp; {
<b class="nc">&nbsp; System.out.println(&quot;Remote exception: Exception during model sending attempt &quot; + e.getMessage());</b>
&nbsp; }
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Requests to draw a tribe card from the upper list.
&nbsp; * Creates a NetworkEvent and sends it through the network client.
&nbsp; * @param playerUsername the name of the player performing the action
&nbsp; * @param pos the index of the card to draw
&nbsp; */
&nbsp; public void drawUpperTribeCard(String playerUsername, int pos) {
<b class="nc">&nbsp; actionQueue.offer(new DrawUpperTribeCard(playerUsername,pos));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Requests to draw a tribe card from the lower list.
&nbsp; * Creates a NetworkEvent and sends it through the network client.
&nbsp; * @param playerUsername the name of the player performing the action
&nbsp; * @param pos the index of the card to draw
&nbsp; */
&nbsp; public void drawLowerTribeCard(String playerUsername,int pos) {
<b class="nc">&nbsp; actionQueue.offer(new DrawLowerTribeCard(playerUsername,pos));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Requests to draw a building card from the upper list.
&nbsp; * Creates a NetworkEvent and sends it through the network client.
&nbsp; * @param playerUsername the name of the player performing the action
&nbsp; * @param pos the index of the card to draw
&nbsp; */
&nbsp; public void drawUpperBuildingCard(String playerUsername,int pos) {
<b class="nc">&nbsp; actionQueue.offer(new DrawUpperBuildingCard(playerUsername,pos));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Requests to draw a building card from the lower list.
&nbsp; * Creates a NetworkEvent and sends it through the network client.
&nbsp; * @param playerUsername the name of the player performing the action
&nbsp; * @param pos the index of the card to draw
&nbsp; */
&nbsp; public void drawLowerBuildingCard(String playerUsername,int pos) {
<b class="nc">&nbsp; actionQueue.offer(new DrawLowerBuildingCard(playerUsername,pos));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Requests to skip the turn.
&nbsp; * This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
&nbsp; * @param playerUsername the name of the player performing the action
&nbsp; */
&nbsp; public void skipTurn(String playerUsername) {
<b class="nc">&nbsp; actionQueue.offer(new SkipTurn(playerUsername));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Used to perform the slot choice action for the specified player at the specified position.
&nbsp; * @param playerUsername the name of the player performing the action
&nbsp; * @param pos the index of the selected slot
&nbsp; */
&nbsp; public void slotChoice(String playerUsername,int pos) {
<b class="nc">&nbsp; actionQueue.offer(new SlotChoice(playerUsername,pos));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Enqueues a totem choice event for the specified player.
&nbsp; *
&nbsp; * @param playerUsername the username of the player choosing the totem.
&nbsp; * @param totems the name of the chosen totem.
&nbsp; * @throws RemoteException if the RMI call fails.
&nbsp; */
&nbsp; public void totemChoice(String playerUsername, String totems) throws RemoteException {
<b class="nc">&nbsp; actionQueue.offer(new TotemChoice(playerUsername,totems));</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Starts the RMI server and binds it to the configured registry.
&nbsp; *
&nbsp; * &lt;p&gt;The method configures the server hostname, creates the RMI registry
&nbsp; * on the specified port, and registers this server instance under the
&nbsp; * {@code RMIGameServer} name.
&nbsp; *
&nbsp; * @return {@code true} if the server starts successfully,
&nbsp; * {@code false} otherwise.
&nbsp; */
&nbsp; public boolean start() {
&nbsp; try {
<b class="nc">&nbsp; System.setProperty(&quot;java.rmi.server.hostname&quot;, host);</b>
<b class="nc">&nbsp; registry = LocateRegistry.createRegistry(nPort);</b>
<b class="nc">&nbsp; registry.rebind(&quot;RMIGameServer&quot;, this);</b>
<b class="nc">&nbsp; System.out.println(&quot;RMI Server started on port: &quot; + nPort);</b>
<b class="nc">&nbsp; return true;</b>
&nbsp; } catch (RemoteException e) {
<b class="nc">&nbsp; e.printStackTrace();</b>
<b class="nc">&nbsp; return false;</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp; /**
&nbsp; * Stops the RMI server and removes its binding from the registry.
&nbsp; *
&nbsp; * &lt;p&gt;The remote server object is unexported, the registry entry associated
&nbsp; * with {@code RMIGameServer} is removed, and the server shutdown is logged.
&nbsp; *
&nbsp; * @return {@code true} if the server is stopped successfully,
&nbsp; * {@code false} otherwise.
&nbsp; */
&nbsp; public boolean stop() {
&nbsp; try {
<b class="nc">&nbsp; registry.unbind(&quot;RMIGameServer&quot;);</b>
<b class="nc">&nbsp; UnicastRemoteObject.unexportObject(this, true);</b>
<b class="nc">&nbsp; watchdogs.values().forEach(RMIHeartbeat::disconnect);</b>
<b class="nc">&nbsp; watchdogs.clear();</b>
<b class="nc">&nbsp; System.out.println(&quot;RMI Server stopped&quot;);</b>
<b class="nc">&nbsp; return true;</b>
&nbsp; } catch (RemoteException | NotBoundException e) {
<b class="nc">&nbsp; e.printStackTrace();</b>
<b class="nc">&nbsp; return false;</b>
&nbsp; }
&nbsp; }
&nbsp;
&nbsp;
&nbsp; /**
&nbsp; * Creates and starts an {@link RMIHeartbeat} for the specified player.
&nbsp; *
&nbsp; * @param username the username of the player monitored by the heartbeat watchdog.
&nbsp; */
&nbsp; private void startWatchdog(String username) {
<b class="nc">&nbsp; RMIHeartbeat wd = new RMIHeartbeat(</b>
&nbsp; username, playerList, clients, actionQueue);
<b class="nc">&nbsp; watchdogs.put(username, wd);</b>
<b class="nc">&nbsp; wd.start();</b>
&nbsp; }
&nbsp; /**
&nbsp; * Triggers a voluntary disconnection for the specified player
&nbsp; * by stopping their heartbeat watchdog.
&nbsp; *
&nbsp; * @param username the username of the player to disconnect.
&nbsp; */
&nbsp; @Override
&nbsp; public void disconnectPlayer(String username) {
<b class="nc">&nbsp; RMIHeartbeat wd = watchdogs.get(username);</b>
<b class="nc">&nbsp; if (wd != null) wd.disconnect();</b>
&nbsp; }
&nbsp;
&nbsp; /** Returns usernames of players currently marked as disconnected in the given game. */
&nbsp; private static ArrayList&lt;String&gt; disconnectedUsernames(Game game) {
<b class="nc">&nbsp; return game.getDisconnectedPlayers().entrySet().stream()</b>
<b class="nc">&nbsp; .filter(Map.Entry::getValue)</b>
<b class="nc">&nbsp; .map(e -&gt; e.getKey().getUserName())</b>
<b class="nc">&nbsp; .collect(Collectors.toCollection(ArrayList::new));</b>
&nbsp; }
&nbsp;
&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>