From b7da5ad6313ae17dee738593ab3482c56675b61a Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Wed, 22 Jun 2011 00:12:06 +0200 Subject: =?UTF-8?q?network=20paket=20vollst=C3=A4ndig=20kommentiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@560 72836036-5685-4462-b002-a69064685172 --- .../control/network/NetworkTurnControl.java | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/jrummikub') diff --git a/src/jrummikub/control/network/NetworkTurnControl.java b/src/jrummikub/control/network/NetworkTurnControl.java index 07d46ba..0f9c478 100644 --- a/src/jrummikub/control/network/NetworkTurnControl.java +++ b/src/jrummikub/control/network/NetworkTurnControl.java @@ -10,14 +10,28 @@ import jrummikub.util.IListener; import jrummikub.util.IListener1; import jrummikub.util.IListener2; +/** + * Turn control for network games + */ public class NetworkTurnControl extends AbstractTurnControl { private IConnectionControl connectionControl; private Event1 stateUpdateEvent = new Event1(); + /** + * Creates new network turn control + * + * @param connectionControl + * the current connection control + */ public NetworkTurnControl(IConnectionControl connectionControl) { this.connectionControl = connectionControl; } + /** + * The state update event is emitted when the state is sent into the network + * + * @return the event + */ public IEvent1 getStateUpdateEvent() { return stateUpdateEvent; } @@ -34,7 +48,8 @@ public class NetworkTurnControl extends AbstractTurnControl { connections.add(connectionControl.getTurnEndEvent().add( new IListener2() { @Override - public void handle(IRoundState state, InvalidTurnInfo invalidTurnInfo) { + public void handle(IRoundState state, + InvalidTurnInfo invalidTurnInfo) { endOfTurn(state, invalidTurnInfo); } })); @@ -48,7 +63,8 @@ public class NetworkTurnControl extends AbstractTurnControl { timer.startTimer(); } - private void endOfTurn(IRoundState roundState, InvalidTurnInfo invalidTurnInfo) { + private void endOfTurn(IRoundState roundState, + InvalidTurnInfo invalidTurnInfo) { cleanUp(); endOfTurnEvent.emit(roundState, invalidTurnInfo); -- cgit v1.2.3