From 51b7fbe822bd9a3804c061f0b844884769d7ddba Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Wed, 6 Jul 2011 16:36:06 +0200 Subject: Javadoc git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@609 72836036-5685-4462-b002-a69064685172 --- doc/jrummikub/control/RoundControl.html | 670 ++++++++++++++++++++++++++++++-- 1 file changed, 632 insertions(+), 38 deletions(-) (limited to 'doc/jrummikub/control/RoundControl.html') diff --git a/doc/jrummikub/control/RoundControl.html b/doc/jrummikub/control/RoundControl.html index b6a8501..4fce933 100644 --- a/doc/jrummikub/control/RoundControl.html +++ b/doc/jrummikub/control/RoundControl.html @@ -2,12 +2,12 @@ - + RoundControl - + @@ -55,8 +55,8 @@ function windowTitle() PREV CLASS  - NEXT CLASSPREV CLASS  + NEXT CLASS FRAMES    NO FRAMES   @@ -76,9 +76,9 @@ function windowTitle() - SUMMARY: NESTED | FIELD | CONSTR | METHOD + SUMMARY: NESTED | FIELD | CONSTR | METHOD -DETAIL: FIELD | CONSTR | METHOD +DETAIL: FIELD | CONSTR | METHOD @@ -95,6 +95,9 @@ Class RoundControl java.lang.Object extended by jrummikub.control.RoundControl +
+
Direct Known Subclasses:
NetworkRoundControl
+

public class RoundControl
extends java.lang.Object
@@ -108,7 +111,107 @@ Controller that manages a single round of rummikub

+ + + + + + + + + + + + + + + +
+Nested Class Summary
+static classRoundControl.InvalidTurnInfo + +
+          Table, stone sets and type of an invalid turn to allow a user to track his + own errors
+static classRoundControl.InvalidTurnType + +
+          Enum summarizing the different types of invalid turns to set the correct + panel message
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Field Summary
+protected  java.util.List<Connection>connections + +
+           
+private  Event1<Score>endOfRoundEvent + +
+           
+private  booleanmayPause + +
+           
+private  Event1<PlayerSettings>restartRoundEvent + +
+           
+protected  IRoundStateroundState +
+           
+private  Event1<IRoundState>roundStateUpdateEvent + +
+           
+private  ITurnControlturnControl + +
+           
+private  IViewview + +
+           
@@ -118,11 +221,23 @@ Controller that manages a single round of rummikub Constructor Summary -RoundControl(IGameState gameState, + +  +RoundControl(IRoundState roundState, IView view)
-          Create a new RoundControl using the given gameState and view +          Create a new RoundControl using the given roundState and view + + + +protected +RoundControl(IRoundState roundState, + IView view, + boolean mayPause) + +
+          Create a new RoundControl using the given roundState and view   @@ -136,30 +251,153 @@ Controller that manages a single round of rummikub -(package private)  void + void +abortRound() + +
+          Abort round if a new one is started or a saved one is loaded + + + +protected  void +addTurnControlListeners(ITurnControl turnControl) + +
+          Override this + + + + void +continueRound() + +
+          Continue a saved round after loading + + + +protected  ITurnControl +createTurnControl() + +
+          Creates new turn control of the specified type + + + +protected  void deal()
-            +          Deal each player the number of stones specified in the game settings + (numberOfStonesDealt) + + + +protected  void +doPrepareTurn() + +
+          Prepare turn by setting the view components (package private)  void -dealStone() +endOfRound()
-            +          Ends the current round and emits an event setting the score - IEvent -getEndRoundEvent() +protected  void +endOfTurn(RoundControl.InvalidTurnInfo invalidTurnInfo) + +
+          End the players turn + + + + IEvent1<Score> +getEndOfRoundEvent()
          End the round + IEvent1<PlayerSettings> +getRestartRoundEvent() + +
+          Emitted when the round is aborted and needs to be restarted + + + + IEvent1<IRoundState> +getRoundStateUpdateEvent() + +
+          Is emitted in network when a new turn starts + + + +protected  void +nextPlayer() + +
+          Set the next player as active player if the round is not finished + + + +protected  void +prepareTurn() + +
+          Prepare a player's turn by checking the player types and setting the + correct turn control + + + +protected  void +redeal() + +
+          Redeal stones and restart round if a player was allowed to redeal and chose + to do so + + + +private  void +removeListeners() + +
+          Removes all listeners form the connections + + + +private  Score +score() + +
+          Calculate the score for the current round and the total game score + + + +protected  void +setRoundState(IRoundState state) + +
+          Sets the current round state + + + +protected  IView.BottomPanelType +showStartTurnPanel() + +
+            + + +  void startRound() @@ -168,12 +406,30 @@ Controller that manages a single round of rummikub -(package private) static java.util.Set<Stone> -tableDifference(ITable oldTable, - ITable newTable) +protected  void +startTurn()
-            +          Start a players turn with the correct turn control + + + +private static Pair<java.lang.Integer,java.lang.Integer> +updateBestScore(Pair<java.lang.Integer,java.lang.Integer> bestScore, + int stonePoints, + int size) + +
+          Update the best score to find the winner in case of special game end + (everybody still has stones on hand) + + + +private  void +updateSidePanel() + +
+          Update the side panel to show correct player order and heap size   @@ -188,6 +444,95 @@ Controller that manages a single round of rummikub  

+ + + + + + + +
+Field Detail
+ +

+turnControl

+
+private ITurnControl turnControl
+
+
+
+
+
+ +

+roundState

+
+protected IRoundState roundState
+
+
+
+
+
+ +

+view

+
+private IView view
+
+
+
+
+
+ +

+restartRoundEvent

+
+private Event1<PlayerSettings> restartRoundEvent
+
+
+
+
+
+ +

+roundStateUpdateEvent

+
+private Event1<IRoundState> roundStateUpdateEvent
+
+
+
+
+
+ +

+endOfRoundEvent

+
+private Event1<Score> endOfRoundEvent
+
+
+
+
+
+ +

+connections

+
+protected java.util.List<Connection> connections
+
+
+
+
+
+ +

+mayPause

+
+private boolean mayPause
+
+
+
+
+ @@ -198,16 +543,30 @@ Controller that manages a single round of rummikub -

+

RoundControl

-public RoundControl(IGameState gameState,
+public RoundControl(IRoundState roundState,
                     IView view)
-
Create a new RoundControl using the given gameState and view +
Create a new RoundControl using the given roundState and view +

+

+
Parameters:
roundState - initial round state
view - view used for user interaction
+
+
+ +

+RoundControl

+
+protected RoundControl(IRoundState roundState,
+                       IView view,
+                       boolean mayPause)
+
+
Create a new RoundControl using the given roundState and view

-
Parameters:
gameState - initial game state
view - view used for user interaction
+
Parameters:
roundState - initial round state
view - view used for user interaction
mayPause - true when players are allowed to pause
@@ -220,16 +579,30 @@ public RoundControl( -

-getEndRoundEvent

+

+getRoundStateUpdateEvent

+
+public IEvent1<IRoundState> getRoundStateUpdateEvent()
+
+
Is emitted in network when a new turn starts +

+

+ +
Returns:
the event
+
+
+
+ +

+getEndOfRoundEvent

-public IEvent getEndRoundEvent()
+public IEvent1<Score> getEndOfRoundEvent()
End the round

-
Returns:
endRoundEvent
+
Returns:
endOfRoundEvent

@@ -247,34 +620,255 @@ public void startRound()
+

+continueRound

+
+public void continueRound()
+
+
Continue a saved round after loading +

+

+
+
+
+
+ +

+abortRound

+
+public void abortRound()
+
+
Abort round if a new one is started or a saved one is loaded +

+

+
+
+
+
+ +

+setRoundState

+
+protected void setRoundState(IRoundState state)
+
+
Sets the current round state +

+

+
Parameters:
state - to be set
+
+
+
+ +

+showStartTurnPanel

+
+protected IView.BottomPanelType showStartTurnPanel()
+
+
+
+
+
+
+ +

+prepareTurn

+
+protected void prepareTurn()
+
+
Prepare a player's turn by checking the player types and setting the + correct turn control +

+

+
+
+
+
+ +

+doPrepareTurn

+
+protected void doPrepareTurn()
+
+
Prepare turn by setting the view components +

+

+
+
+
+
+ +

+startTurn

+
+protected void startTurn()
+
+
Start a players turn with the correct turn control +

+

+
+
+
+
+ +

+updateSidePanel

+
+private void updateSidePanel()
+
+
Update the side panel to show correct player order and heap size +

+

+
+
+
+
+ +

+addTurnControlListeners

+
+protected void addTurnControlListeners(ITurnControl turnControl)
+
+
Override this +

+

+
Parameters:
turnControl - current turn control
+
+
+
+ +

+createTurnControl

+
+protected ITurnControl createTurnControl()
+
+
Creates new turn control of the specified type +

+

+ +
Returns:
the new turn control
+
+
+
+

deal

-void deal()
+protected void deal()
+
Deal each player the number of stones specified in the game settings + (numberOfStonesDealt) +


-

-tableDifference

+

+endOfTurn

-static java.util.Set<Stone> tableDifference(ITable oldTable,
-                                            ITable newTable)
+protected void endOfTurn(RoundControl.InvalidTurnInfo invalidTurnInfo)
+
End the players turn +

+
Parameters:
invalidTurnInfo - info about the player's last turn
+
+
+ +

+nextPlayer

+
+protected void nextPlayer()
+
+
Set the next player as active player if the round is not finished +

+

+
+
+
+
+ +

+endOfRound

+
+void endOfRound()
+
+
Ends the current round and emits an event setting the score +

+

+
+
+
+
+ +

+removeListeners

+
+private void removeListeners()
+
+
Removes all listeners form the connections +

+

+
+
+
+
+ +

+score

+
+private Score score()
+
+
Calculate the score for the current round and the total game score +

+

+ +
Returns:
the new score
+
+
+
+ +

+updateBestScore

+
+private static Pair<java.lang.Integer,java.lang.Integer> updateBestScore(Pair<java.lang.Integer,java.lang.Integer> bestScore,
+                                                                         int stonePoints,
+                                                                         int size)
+
+
Update the best score to find the winner in case of special game end + (everybody still has stones on hand) +

+

+
Parameters:
bestScore - of previous rounds
stonePoints - sum of points still left on hands
size - number of players in game (= size of score list in columns) +
Returns:
Pair of maximum points and hand size
+
+
+
+ +

+getRestartRoundEvent

+
+public IEvent1<PlayerSettings> getRestartRoundEvent()
+
+
Emitted when the round is aborted and needs to be restarted +

+

+ +
Returns:
the event

-

-dealStone

+

+redeal

-void dealStone()
+protected void redeal()
+
Redeal stones and restart round if a player was allowed to redeal and chose + to do so +

@@ -310,8 +904,8 @@ void dealStone() PREV CLASS  - NEXT CLASSPREV CLASS  + NEXT CLASS FRAMES    NO FRAMES   @@ -331,9 +925,9 @@ void dealStone() - SUMMARY: NESTED | FIELD | CONSTR | METHOD + SUMMARY: NESTED | FIELD | CONSTR | METHOD -DETAIL: FIELD | CONSTR | METHOD +DETAIL: FIELD | CONSTR | METHOD -- cgit v1.2.3