Test für RoundControl fertig
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@128 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
db7489a5c7
commit
e2f82f3f28
10 changed files with 296 additions and 36 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Reference in a new issue