Package game

Class TrickImpl

java.lang.Object
game.TrickImpl
All Implemented Interfaces:
Trick

public class TrickImpl extends Object implements Trick
  • Constructor Details

    • TrickImpl

      public TrickImpl(int numberOfPlayers, CardSuit trump)
  • Method Details

    • addCard

      public void addCard(Card<CardValue,CardSuit> card, String username)
      Description copied from interface: Trick
      add a card played by a player
      Specified by:
      addCard in interface Trick
      Parameters:
      card - added to the trick, if not all the players has already played
    • getCall

      public Call getCall()
      Specified by:
      getCall in interface Trick
      Returns:
      the call of this trick
    • setCall

      public void setCall(Call call, String username)
      Specified by:
      setCall in interface Trick
      Parameters:
      call - the call
      username - the user who makes the call check if the user can make a call and if true set the call
    • getCards

      @BsonIgnore public List<String> getCards()
      Specified by:
      getCards in interface Trick
      Returns:
      the cards in the trick
    • getCardsAndUsers

      public Map<String,String> getCardsAndUsers()
      Specified by:
      getCardsAndUsers in interface Trick
      Returns:
      the cards and the users in the trick
    • getNumberOfPlayers

      public int getNumberOfPlayers()
    • getTrump

      public CardSuit getTrump()
    • isCompleted

      @BsonIgnore public boolean isCompleted()
      Description copied from interface: Trick
      check if the trick is completed
      Specified by:
      isCompleted in interface Trick
      Returns:
      true if all the players have played their card
    • toString

      public String toString()
      Overrides:
      toString in class Object