From e2f82f3f28a0872ed626439809a292e701c9b01e Mon Sep 17 00:00:00 2001 From: Ida Massow Date: Wed, 4 May 2011 23:26:01 +0200 Subject: =?UTF-8?q?Test=20f=C3=BCr=20RoundControl=20fertig?= 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@128 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/control/RoundControl.java | 6 +++--- src/jrummikub/model/GameState.java | 12 +++++++++--- src/jrummikub/model/Player.java | 4 +++- 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src') 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 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; } -- cgit v1.2.3