179 lines
4.6 KiB
HTML
179 lines
4.6 KiB
HTML
|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html id="htmlId">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
|
|
<title>Coverage Report > ClientCallbackImpl</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.Client</a>
|
|
</div>
|
|
|
|
<h1>Coverage Summary for Class: ClientCallbackImpl (it.polimi.ingsw.gc14.Network.RMI.Client)</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">ClientCallbackImpl</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/2)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
0%
|
|
</span>
|
|
<span class="absValue">
|
|
(0/8)
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<pre>
|
|
<code class="sourceCode" id="sourceCode"> package it.polimi.ingsw.gc14.Network.RMI.Client;
|
|
|
|
import it.polimi.ingsw.gc14.Controller.ClientController;
|
|
import it.polimi.ingsw.gc14.Model.MiniModel;
|
|
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
|
import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback;
|
|
|
|
import java.rmi.RemoteException;
|
|
import java.rmi.server.UnicastRemoteObject;
|
|
|
|
|
|
/**
|
|
* RMI client callback implementation of {@link IClientCallback}.
|
|
* Receives notifications from the server and updates the client game model.
|
|
*/
|
|
public class ClientCallbackImpl extends UnicastRemoteObject implements IClientCallback {
|
|
|
|
/** The client controller used to apply events and update the model */
|
|
private final ClientController clientController;
|
|
|
|
|
|
/**
|
|
* Class constructor.
|
|
* @param clientController the client controller
|
|
* @throws RemoteException if any RMI error occurs
|
|
*/
|
|
<b class="nc"> public ClientCallbackImpl(ClientController clientController) throws RemoteException {</b>
|
|
<b class="nc"> this.clientController = clientController;</b>
|
|
}
|
|
|
|
|
|
/**
|
|
* Called by the server when the game is initialized.
|
|
* Sets the client game model in the {@link ClientController}.
|
|
* @param model the initialized {@link it.polimi.ingsw.gc14.Model.Game Game} model
|
|
* @throws RemoteException if any RMI error occurs
|
|
*/
|
|
@Override
|
|
public void onGameInit(MiniModel model) throws RemoteException {
|
|
<b class="nc"> clientController.setModel(model);</b>
|
|
<b class="nc"> clientController.getView().render();</b>
|
|
}
|
|
|
|
|
|
/**
|
|
* Called by the server when an action has been accepted.
|
|
* If the event contains an error, it is printed to the console.
|
|
* Otherwise, the event is applied to the local model.
|
|
* @param event the {@link NetworkEvent} sent by the server
|
|
* @throws RemoteException if any RMI error occurs
|
|
*/
|
|
@Override
|
|
public void onAction(NetworkEvent event) throws RemoteException {
|
|
<b class="nc"> if(event.isError()) {</b>
|
|
<b class="nc"> clientController.getView().showError(event.getErrorType(),event.toString());</b>
|
|
} else {
|
|
<b class="nc"> event.apply(clientController.getMiniModel());</b>
|
|
<b class="nc"> clientController.getView().render();</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>
|