Class Repository
java.lang.Object
GameRules
Repository
public class Repository extends GameRules
this class keep a game cards
its one of GameRules subclass
-
Field Summary
Fields inherited from class GameRules
black, blue, green, plus2Counter, plus4Counter, red, sideBase, yellow
-
Constructor Summary
Constructors Constructor Description Repository()
creat a new repository -
Method Summary
Modifier and Type Method Description void
addCard(java.lang.String value)
add a card to repositoryjava.lang.String
getCard(int index)
get a card by its indexjava.util.ArrayList<java.lang.String>
getCards()
get all the cards of a gamevoid
removeCard(int index)
remove a card by its indexMethods inherited from class GameRules
cardAction, checkPutCard, designGround, endGame, firstBase, getColor, getDirection, getNumber, getPlusFourState, getPlusTwoState, getTurn, giveCard, printScore, printScoreChart, putCart, setDirection, setTurn
-
Constructor Details
-
Repository
public Repository()creat a new repository
-
-
Method Details
-
addCard
public void addCard(java.lang.String value)add a card to repository- Parameters:
value
- of card
-
getCard
public java.lang.String getCard(int index)get a card by its index- Parameters:
index
- of card- Returns:
- card
-
removeCard
public void removeCard(int index)remove a card by its index- Parameters:
index
- of card
-
getCards
public java.util.ArrayList<java.lang.String> getCards()get all the cards of a game- Returns:
- array list of cards
-