156 lines
4.0 KiB
HTML
156 lines
4.0 KiB
HTML
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html id="htmlId">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
<title>Coverage Report > CompositeClientBroadcaster</title>
|
|
<style type="text/css">
|
|
@import "../../css/coverage.css";
|
|
@import "../../css/idea.min.css";
|
|
</style>
|
|
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
|
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content">
|
|
<div class="breadCrumbs">
|
|
Current scope: <a href="../../index.html">all classes</a>
|
|
<span class="separator">|</span>
|
|
<a href="../index.html">it.polimi.ingsw.gc14.Network</a>
|
|
</div>
|
|
|
|
<h1>Coverage Summary for Class: CompositeClientBroadcaster (it.polimi.ingsw.gc14.Network)</h1>
|
|
|
|
<table class="coverageStats">
|
|
<tr>
|
|
<th class="name">Class</th>
|
|
<th class="coverageStat
|
|
">
|
|
Class, %
|
|
</th>
|
|
<th class="coverageStat
|
|
">
|
|
Method, %
|
|
</th>
|
|
<th class="coverageStat
|
|
">
|
|
Line, %
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">CompositeClientBroadcaster</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/3)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
0%
|
|
</span>
|
|
<span class="absValue">
|
|
(0/7)
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<pre>
|
|
<code class="sourceCode" id="sourceCode"> package it.polimi.ingsw.gc14.Network;
|
|
|
|
import it.polimi.ingsw.gc14.Model.MiniModel;
|
|
import it.polimi.ingsw.gc14.Network.RMI.Server.RMIServer;
|
|
import it.polimi.ingsw.gc14.Network.TCP.Server.TCPServer;
|
|
|
|
/**
|
|
* Forwards every notification to both the RMI and the TCP transport layers.
|
|
*
|
|
* <p>This follows the Composite pattern: the caller interacts with a single
|
|
* broadcaster without knowing which protocols are active underneath.
|
|
*/
|
|
public class CompositeClientBroadcaster {
|
|
/** RMI transport used to reach RMI-connected clients. */
|
|
private final RMIServer rmiServer;
|
|
/** TCP transport used to reach TCP-connected clients. */
|
|
private final TCPServer tcpServer;
|
|
|
|
/**
|
|
* Constructs a composite broadcaster backed by the given RMI and TCP servers.
|
|
*
|
|
* @param rmiServer the RMI server used to reach RMI clients.
|
|
* @param tcpServer the TCP server used to reach TCP clients.
|
|
*/
|
|
<b class="nc"> public CompositeClientBroadcaster(RMIServer rmiServer, TCPServer tcpServer) {</b>
|
|
<b class="nc"> this.rmiServer = rmiServer;</b>
|
|
<b class="nc"> this.tcpServer = tcpServer;</b>
|
|
}
|
|
|
|
/**
|
|
* Forwards the event to both the RMI and the TCP server.
|
|
* Each server is responsible for filtering error events to the
|
|
* requesting player only.
|
|
*
|
|
* @param event the network event to broadcast.
|
|
*/
|
|
public void notifyAll(NetworkEvent event) {
|
|
<b class="nc"> rmiServer.notifyAll(event);</b>
|
|
<b class="nc"> tcpServer.notifyAll(event);</b>
|
|
}
|
|
|
|
/**
|
|
* Forwards the model snapshot to every client on both transports.
|
|
*
|
|
* @param model the mini model snapshot to broadcast.
|
|
*/
|
|
public void notifyAll(MiniModel model) {
|
|
<b class="nc"> rmiServer.notifyAll(model);</b>
|
|
<b class="nc"> tcpServer.notifyAll(model);</b>
|
|
}
|
|
}
|
|
</code>
|
|
</pre>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
(function() {
|
|
var msie = false, msie9 = false;
|
|
/*@cc_on
|
|
msie = true;
|
|
@if (@_jscript_version >= 9)
|
|
msie9 = true;
|
|
@end
|
|
@*/
|
|
|
|
if (!msie || msie && msie9) {
|
|
hljs.highlightAll()
|
|
hljs.initLineNumbersOnLoad();
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<div class="footer">
|
|
|
|
<div style="float:right;">generated on 2026-06-19 22:53</div>
|
|
</div>
|
|
</body>
|
|
</html>
|