summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/control/turn/ITurnControl.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/jrummikub/control/turn/ITurnControl.java')
-rw-r--r--src/jrummikub/control/turn/ITurnControl.java81
1 files changed, 71 insertions, 10 deletions
diff --git a/src/jrummikub/control/turn/ITurnControl.java b/src/jrummikub/control/turn/ITurnControl.java
index 2dfe2ab..b8a39ce 100644
--- a/src/jrummikub/control/turn/ITurnControl.java
+++ b/src/jrummikub/control/turn/ITurnControl.java
@@ -1,7 +1,7 @@
package jrummikub.control.turn;
import jrummikub.model.GameSettings;
-import jrummikub.model.IPlayer;
+import jrummikub.model.IHand;
import jrummikub.model.ITable;
import jrummikub.util.IEvent;
import jrummikub.view.IView;
@@ -14,19 +14,15 @@ public interface ITurnControl {
/**
* Start the turn
*
+ * @param info
+ * the current turn state
+ *
* @param settings
* the game settings
- * @param player
- * the active player
- * @param table
- * current table
* @param view
* view for user interaction.
- * @param turnMode
- * whether it is turn zero and if one may redeal
*/
- public void setup(GameSettings settings, IPlayer player, ITable table,
- IView view, TurnMode turnMode);
+ public void setup(TurnInfo info, GameSettings settings, IView view);
/**
* Get the event that is emitted when the turn is over
@@ -45,6 +41,71 @@ public interface ITurnControl {
/**
* Start the turn
*/
- public abstract void startTurn();
+ public void startTurn();
+
+ /**
+ * The TurnInfo class encapsulates all information concerning the current turn
+ */
+ public class TurnInfo {
+ private ITable table;
+ private IHand hand;
+ private boolean hasLaidOut;
+ private TurnMode turnMode;
+
+ /**
+ * Creates a new TurnInfo instance
+ *
+ * @param table
+ * the current table
+ * @param hand
+ * the current player's hand
+ * @param hasLaidOut
+ * has the player laid out yet?
+ * @param turnMode
+ * the turn mode
+ */
+ public TurnInfo(ITable table, IHand hand, boolean hasLaidOut,
+ TurnMode turnMode) {
+ this.table = table;
+ this.hand = hand;
+ this.hasLaidOut = hasLaidOut;
+ this.turnMode = turnMode;
+ }
+
+ /**
+ * Gets the current table
+ *
+ * @return the table
+ */
+ public ITable getTable() {
+ return table;
+ }
+
+ /**
+ * Gets the current player's hand
+ *
+ * @return the hand
+ */
+ public IHand getHand() {
+ return hand;
+ }
+
+ /**
+ * Returns if the current player has laid out yet
+ *
+ * @return if the player has laid out
+ */
+ public boolean getLaidOut() {
+ return hasLaidOut;
+ }
+ /**
+ * Gets the current turn's mode
+ *
+ * @return the turn mode
+ */
+ public TurnMode getTurnMode() {
+ return turnMode;
+ }
+ }
} \ No newline at end of file