summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/jrummikub/control/RoundControl.java6
-rw-r--r--src/jrummikub/model/GameState.java12
-rw-r--r--src/jrummikub/model/Player.java4
3 files changed, 15 insertions, 7 deletions
diff --git a/src/jrummikub/control/RoundControl.java b/src/jrummikub/control/RoundControl.java
index ec08050..a481991 100644
--- a/src/jrummikub/control/RoundControl.java
+++ b/src/jrummikub/control/RoundControl.java
@@ -1,16 +1,16 @@
package jrummikub.control;
-import jrummikub.model.GameState;
+import jrummikub.model.IGameState;
import jrummikub.model.IHand;
import jrummikub.model.Player;
import jrummikub.model.Position;
import jrummikub.view.IView;
public class RoundControl {
- private GameState gameState;
+ private IGameState gameState;
private IView view;
- public RoundControl(GameState gameState, IView view) {
+ public RoundControl(IGameState gameState, IView view) {
this.gameState = gameState;
this.view = view;
}
diff --git a/src/jrummikub/model/GameState.java b/src/jrummikub/model/GameState.java
index e1bd6f3..0e43a9c 100644
--- a/src/jrummikub/model/GameState.java
+++ b/src/jrummikub/model/GameState.java
@@ -5,7 +5,7 @@ import java.util.ArrayList;
import java.util.List;
/** Class managing the overall and momentary GameState */
-public class GameState {
+public class GameState implements IGameState {
private ITable table;
private List<Player> players;
private int activePlayer;
@@ -22,27 +22,33 @@ public class GameState {
gameHeap = new StoneHeap();
}
+ @Override
public ITable getTable() {
return table;
}
+ @Override
public int getPlayerCount() {
return players.size();
}
- public Player getPlayer(int i) {
+ @Override
+ public IPlayer getPlayer(int i) {
return players.get(i);
}
/** Changes the activePlayer to the next {@link Player} in the list */
+ @Override
public void nextPlayer() {
activePlayer = (activePlayer + 1) % players.size();
}
- public Player getActivePlayer() {
+ @Override
+ public IPlayer getActivePlayer() {
return players.get(activePlayer);
}
+ @Override
public StoneHeap getGameHeap() {
return gameHeap;
}
diff --git a/src/jrummikub/model/Player.java b/src/jrummikub/model/Player.java
index 50a525a..d5bda32 100644
--- a/src/jrummikub/model/Player.java
+++ b/src/jrummikub/model/Player.java
@@ -3,7 +3,7 @@ package jrummikub.model;
import java.awt.Color;
/** Class managing player data. No methods in release 1 */
-public class Player {
+public class Player implements IPlayer {
private IHand hand;
private Color color;
@@ -15,10 +15,12 @@ public class Player {
this.color = color;
}
+ @Override
public IHand getHand() {
return hand;
}
+ @Override
public Color getColor() {
return color;
}