Viele Warnings durch Kommentare beseitigt
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@312 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
65d08ea450
commit
e4a1246f01
8 changed files with 51 additions and 10 deletions
|
@ -3,6 +3,7 @@ package jrummikub.view;
|
||||||
import jrummikub.model.PlayerSettings;
|
import jrummikub.model.PlayerSettings;
|
||||||
import jrummikub.model.Score;
|
import jrummikub.model.Score;
|
||||||
|
|
||||||
|
/** */
|
||||||
public class MockScorePanel implements IScorePanel {
|
public class MockScorePanel implements IScorePanel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,23 +10,38 @@ import jrummikub.util.MockEvent;
|
||||||
import jrummikub.util.MockEvent1;
|
import jrummikub.util.MockEvent1;
|
||||||
import jrummikub.util.MockEvent2;
|
import jrummikub.util.MockEvent2;
|
||||||
|
|
||||||
|
/** */
|
||||||
public class MockSettingsPanel implements ISettingsPanel {
|
public class MockSettingsPanel implements ISettingsPanel {
|
||||||
|
|
||||||
|
/** */
|
||||||
public MockEvent addPlayerEvent = new MockEvent();
|
public MockEvent addPlayerEvent = new MockEvent();
|
||||||
|
/** */
|
||||||
public MockEvent1<Integer> removePlayerEvent = new MockEvent1<Integer>();
|
public MockEvent1<Integer> removePlayerEvent = new MockEvent1<Integer>();
|
||||||
|
/** */
|
||||||
public MockEvent2<Integer, Color> changePlayerColorEvent = new MockEvent2<Integer, Color>();
|
public MockEvent2<Integer, Color> changePlayerColorEvent = new MockEvent2<Integer, Color>();
|
||||||
|
/** */
|
||||||
public MockEvent2<Integer, String> changePlayerNameEvent = new MockEvent2<Integer, String>();
|
public MockEvent2<Integer, String> changePlayerNameEvent = new MockEvent2<Integer, String>();
|
||||||
|
/** */
|
||||||
public MockEvent startGameEvent = new MockEvent();
|
public MockEvent startGameEvent = new MockEvent();
|
||||||
|
/** */
|
||||||
public SettingsError error = SettingsError.NO_ERROR;
|
public SettingsError error = SettingsError.NO_ERROR;
|
||||||
|
/** */
|
||||||
public boolean startButtonEnabled = true;
|
public boolean startButtonEnabled = true;
|
||||||
|
/** */
|
||||||
public boolean addPlayerButtonEnabled = true;
|
public boolean addPlayerButtonEnabled = true;
|
||||||
|
/** */
|
||||||
public boolean removePlayerButtonsEnabled = false;
|
public boolean removePlayerButtonsEnabled = false;
|
||||||
|
/** */
|
||||||
public GameSettings gameSettings = new GameSettings();
|
public GameSettings gameSettings = new GameSettings();
|
||||||
|
|
||||||
|
/** */
|
||||||
public MockEvent1<Integer> changeInitialMeldThresholdEvent = new MockEvent1<Integer>();
|
public MockEvent1<Integer> changeInitialMeldThresholdEvent = new MockEvent1<Integer>();
|
||||||
|
/** */
|
||||||
public MockEvent1<Integer> changeJokerNumberEvent = new MockEvent1<Integer>();
|
public MockEvent1<Integer> changeJokerNumberEvent = new MockEvent1<Integer>();
|
||||||
|
|
||||||
|
/** */
|
||||||
public int initialMeldThreshold;
|
public int initialMeldThreshold;
|
||||||
|
/** */
|
||||||
public int jokerNumber;
|
public int jokerNumber;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
package jrummikub.control;
|
package jrummikub.control;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import jrummikub.model.GameSettings;
|
import jrummikub.model.GameSettings;
|
||||||
import jrummikub.util.Connection;
|
|
||||||
import jrummikub.util.IListener;
|
import jrummikub.util.IListener;
|
||||||
import jrummikub.util.IListener1;
|
import jrummikub.util.IListener1;
|
||||||
import jrummikub.view.IView;
|
import jrummikub.view.IView;
|
||||||
|
|
|
@ -64,6 +64,11 @@ public class GameControl {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is emitted when the user ends the game and start a new one
|
||||||
|
*
|
||||||
|
* @return the endOfGameEvent
|
||||||
|
*/
|
||||||
public IEvent getEndOfGameEvent() {
|
public IEvent getEndOfGameEvent() {
|
||||||
return endOfGameEvent;
|
return endOfGameEvent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import jrummikub.control.turn.HumanTurnControl;
|
|
||||||
import jrummikub.control.turn.ITurnControl;
|
import jrummikub.control.turn.ITurnControl;
|
||||||
import jrummikub.model.Hand;
|
import jrummikub.model.Hand;
|
||||||
import jrummikub.model.IHand;
|
import jrummikub.model.IHand;
|
||||||
|
|
|
@ -15,8 +15,13 @@ import java.util.Random;
|
||||||
public class StoneHeap {
|
public class StoneHeap {
|
||||||
List<Stone> heap;
|
List<Stone> heap;
|
||||||
private Random generator = new Random();
|
private Random generator = new Random();
|
||||||
|
|
||||||
/** Creates 106 Stones according to standard rules */
|
/**
|
||||||
|
* Creates 106 Stones according to standard rules
|
||||||
|
*
|
||||||
|
* @param gameSettings
|
||||||
|
* (for number of sets/jokers, colors etc.)
|
||||||
|
* */
|
||||||
public StoneHeap(GameSettings gameSettings) {
|
public StoneHeap(GameSettings gameSettings) {
|
||||||
heap = new ArrayList<Stone>();
|
heap = new ArrayList<Stone>();
|
||||||
for (int i = 1; i <= 13; i++) {
|
for (int i = 1; i <= 13; i++) {
|
||||||
|
@ -35,7 +40,7 @@ public class StoneHeap {
|
||||||
jokerColors.set(3, temp);
|
jokerColors.set(3, temp);
|
||||||
|
|
||||||
int jokersLeft = gameSettings.getJokerNumber();
|
int jokersLeft = gameSettings.getJokerNumber();
|
||||||
done : while(true) {
|
done: while (true) {
|
||||||
for (StoneColor c : jokerColors) {
|
for (StoneColor c : jokerColors) {
|
||||||
if (jokersLeft == 0)
|
if (jokersLeft == 0)
|
||||||
break done;
|
break done;
|
||||||
|
|
|
@ -112,9 +112,26 @@ public interface IView {
|
||||||
*/
|
*/
|
||||||
public void showScorePanel(boolean show);
|
public void showScorePanel(boolean show);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is used for the PlayerPanel and ScorePanel to display a player's color
|
||||||
|
* along with the name
|
||||||
|
*
|
||||||
|
* @param color
|
||||||
|
*/
|
||||||
public void setCurrentPlayerColor(Color color);
|
public void setCurrentPlayerColor(Color color);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is used for the PlayerPanel to display if a player has laid out along
|
||||||
|
* with the name
|
||||||
|
*
|
||||||
|
* @param hasLaidOut
|
||||||
|
*/
|
||||||
public void setHasLaidOut(boolean hasLaidOut);
|
public void setHasLaidOut(boolean hasLaidOut);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is emitted if the player wants to end the game and start a new one
|
||||||
|
*
|
||||||
|
* @return newGameEvent
|
||||||
|
*/
|
||||||
IEvent getNewGameEvent();
|
IEvent getNewGameEvent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,9 +6,11 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
/** */
|
||||||
public class GameStateTest {
|
public class GameStateTest {
|
||||||
GameState gameState = new GameState();
|
GameState gameState = new GameState();
|
||||||
|
|
||||||
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void testAccumulatedScore() {
|
public void testAccumulatedScore() {
|
||||||
Score score1 = new Score(Arrays.asList(true, false, false), Arrays.asList(
|
Score score1 = new Score(Arrays.asList(true, false, false), Arrays.asList(
|
||||||
|
@ -27,6 +29,7 @@ public class GameStateTest {
|
||||||
assertEquals(Arrays.asList(-30, -60, -40), accum.getPoints());
|
assertEquals(Arrays.asList(-30, -60, -40), accum.getPoints());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** */
|
||||||
@Test
|
@Test
|
||||||
public void testAccumulatedScoreDraw() {
|
public void testAccumulatedScoreDraw() {
|
||||||
Score score1 = new Score(Arrays.asList(true, false, false), Arrays.asList(
|
Score score1 = new Score(Arrays.asList(true, false, false), Arrays.asList(
|
||||||
|
|
Reference in a new issue