public class GameModel
extends java.util.Observable
ConsoleGameModel class consists in the MVP architecture model
It handles Tarot dealer choosing,
dealing, bids and ecart constitutionObservable,
Card,
Hand,
PlayerHandler,
Talon| Constructor and Description |
|---|
GameModel(boolean dealerChoosingEnabled)
Constructs app model by creating players, chien and cards
|
| Modifier and Type | Method and Description |
|---|---|
void |
createCards()
Creates all cards and puts them in wholeCardsDeck
|
void |
cutDeck()
Cuts a deck of cards
|
void |
dealAllCards()
Deals card
|
void |
gatherAllCards()
Retrieve all cards from players and talon
to the initial deck
|
NotificationType |
getAwaitsUserEvent() |
GameState |
getGameState() |
java.lang.Thread |
getGameThread() |
Hand |
getOurPlayer() |
CardGroup |
getPickedCardsDeck() |
PlayerHandler |
getPlayerHandler() |
Talon |
getTalon() |
CardGroup |
getToPickDeck() |
CardGroup |
getWholeCardsDeck() |
void |
moveCardBetweenDecks(CardGroup source,
CardGroup target,
Card c,
boolean doesNotifyObserver)
Moves a card between two decks
|
void |
notifyObserversOfCardUpdate(CardUpdate cardUpdate)
Notifies model observers with the type of card update
it shall operate to update itself
|
void |
quitGame()
Properly quit the game by removing all cards
and notifying observer of the removal
|
Card |
randomCard(java.util.List<Card> list)
Gets a random card in a card list
|
void |
setAwaitsUserEventToNull() |
void |
setLastEndedAnimation(int lastEndedAnimation) |
void |
setUserChoice(int userChoice) |
void |
shuffleCards()
Shuffles cards
|
public GameModel(boolean dealerChoosingEnabled)
throws CardGroupNumberException
dealerChoosingEnabled - the mode chosen to run the gameCardGroupNumberException - if user tries to create too much handspublic void createCards()
public void dealAllCards()
public void gatherAllCards()
public void quitGame()
public void shuffleCards()
Collections,
Randompublic void cutDeck()
public void moveCardBetweenDecks(CardGroup source, CardGroup target, Card c, boolean doesNotifyObserver)
source - the source decktarget - the target deckc - the card to movedoesNotifyObserver - allows to enable/disable move animationpublic Card randomCard(java.util.List<Card> list)
list - the list used to return a random cardRandompublic void notifyObserversOfCardUpdate(CardUpdate cardUpdate)
cardUpdate - the cardUpdate to send to notifyObservablepublic CardGroup getWholeCardsDeck()
public CardGroup getToPickDeck()
public CardGroup getPickedCardsDeck()
public PlayerHandler getPlayerHandler()
public Talon getTalon()
public Hand getOurPlayer()
public NotificationType getAwaitsUserEvent()
public java.lang.Thread getGameThread()
public GameState getGameState()
public void setUserChoice(int userChoice)
public void setAwaitsUserEventToNull()
public void setLastEndedAnimation(int lastEndedAnimation)