diff options
author | jbion <joffrey.bion@amadeus.com> | 2016-12-22 01:53:02 +0100 |
---|---|---|
committer | jbion <joffrey.bion@amadeus.com> | 2016-12-22 01:53:02 +0100 |
commit | 168494da4601fbdce7578f40c4ec9b1ae127fc5f (patch) | |
tree | ee98dc94660a7771a0a468d5c184342a72fd4a00 | |
parent | Fix unsupported remove operation in assignBoards() (diff) | |
download | seven-wonders-168494da4601fbdce7578f40c4ec9b1ae127fc5f.tar.gz seven-wonders-168494da4601fbdce7578f40c4ec9b1ae127fc5f.tar.bz2 seven-wonders-168494da4601fbdce7578f40c4ec9b1ae127fc5f.zip |
Move Decks to the cards package
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/Game.java | 1 | ||||
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/cards/Decks.java (renamed from src/main/java/org/luxons/sevenwonders/game/Decks.java) | 10 | ||||
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/data/GameDefinition.java | 2 | ||||
-rw-r--r-- | src/main/java/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.java | 2 | ||||
-rw-r--r-- | src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java (renamed from src/test/java/org/luxons/sevenwonders/game/DecksTest.java) | 6 |
5 files changed, 9 insertions, 12 deletions
diff --git a/src/main/java/org/luxons/sevenwonders/game/Game.java b/src/main/java/org/luxons/sevenwonders/game/Game.java index 3e0c2839..389ef844 100644 --- a/src/main/java/org/luxons/sevenwonders/game/Game.java +++ b/src/main/java/org/luxons/sevenwonders/game/Game.java @@ -11,6 +11,7 @@ import org.luxons.sevenwonders.game.api.PlayerTurnInfo; import org.luxons.sevenwonders.game.api.Table; import org.luxons.sevenwonders.game.boards.Board; import org.luxons.sevenwonders.game.cards.Card; +import org.luxons.sevenwonders.game.cards.Decks; public class Game { diff --git a/src/main/java/org/luxons/sevenwonders/game/Decks.java b/src/main/java/org/luxons/sevenwonders/game/cards/Decks.java index 5ecc3000..b798b035 100644 --- a/src/main/java/org/luxons/sevenwonders/game/Decks.java +++ b/src/main/java/org/luxons/sevenwonders/game/cards/Decks.java @@ -1,12 +1,10 @@ -package org.luxons.sevenwonders.game; +package org.luxons.sevenwonders.game.cards; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.luxons.sevenwonders.game.cards.Card; - public class Decks { private Map<Integer, List<Card>> cardsPerAge = new HashMap<>(); @@ -15,7 +13,7 @@ public class Decks { this.cardsPerAge = cardsPerAge; } - Card getCard(String cardName) throws CardNotFoundException { + public Card getCard(String cardName) throws CardNotFoundException { return cardsPerAge.values() .stream() .flatMap(List::stream) @@ -24,7 +22,7 @@ public class Decks { .orElseThrow(() -> new CardNotFoundException(cardName)); } - Map<Integer, List<Card>> deal(int age, int nbPlayers) { + public Map<Integer, List<Card>> deal(int age, int nbPlayers) { List<Card> deck = getDeck(age); validateNbCards(deck, nbPlayers); return deal(deck, nbPlayers); @@ -57,7 +55,7 @@ public class Decks { return hands; } - public class CardNotFoundException extends RuntimeException { + class CardNotFoundException extends RuntimeException { CardNotFoundException(String message) { super(message); } diff --git a/src/main/java/org/luxons/sevenwonders/game/data/GameDefinition.java b/src/main/java/org/luxons/sevenwonders/game/data/GameDefinition.java index 2e43b370..05de6162 100644 --- a/src/main/java/org/luxons/sevenwonders/game/data/GameDefinition.java +++ b/src/main/java/org/luxons/sevenwonders/game/data/GameDefinition.java @@ -5,7 +5,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; -import org.luxons.sevenwonders.game.Decks; +import org.luxons.sevenwonders.game.cards.Decks; import org.luxons.sevenwonders.game.Game; import org.luxons.sevenwonders.game.Player; import org.luxons.sevenwonders.game.Settings; diff --git a/src/main/java/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.java b/src/main/java/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.java index 4a7888a0..e50b6214 100644 --- a/src/main/java/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.java +++ b/src/main/java/org/luxons/sevenwonders/game/data/definitions/DecksDefinition.java @@ -9,7 +9,7 @@ import java.util.stream.Collectors; import org.luxons.sevenwonders.game.Settings; import org.luxons.sevenwonders.game.cards.Card; -import org.luxons.sevenwonders.game.Decks; +import org.luxons.sevenwonders.game.cards.Decks; public class DecksDefinition implements Definition<Decks> { diff --git a/src/test/java/org/luxons/sevenwonders/game/DecksTest.java b/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java index a00e9c76..b7fad970 100644 --- a/src/test/java/org/luxons/sevenwonders/game/DecksTest.java +++ b/src/test/java/org/luxons/sevenwonders/game/cards/DecksTest.java @@ -1,4 +1,4 @@ -package org.luxons.sevenwonders.game; +package org.luxons.sevenwonders.game.cards; import java.util.ArrayList; import java.util.HashMap; @@ -6,9 +6,7 @@ import java.util.List; import java.util.Map; import org.junit.Test; -import org.luxons.sevenwonders.game.Decks.CardNotFoundException; -import org.luxons.sevenwonders.game.cards.Card; -import org.luxons.sevenwonders.game.cards.Color; +import org.luxons.sevenwonders.game.cards.Decks.CardNotFoundException; import static org.junit.Assert.*; |