Class Wildcard

java.lang.Object
me.ramendev.expokert.Card
me.ramendev.expokert.Wildcard
Direct Known Subclasses:
FixedWildcard

public abstract class Wildcard extends Card
The wildcard, which is a card that can be considered as another "real" Card. There are variations of wildcards, such as the Joker, the "universal" wildcard.
  • Constructor Details

    • Wildcard

      public Wildcard()
      Constructor for a wildcard. A wildcard will always use Pip.WILD and Suit.WILD.
  • Method Details

    • canBe

      public final boolean canBe(Card card)
      Checks whether this wildcard "can be" another card, in this case, whether it can be converted to the given Card.
      Parameters:
      card - The card to check against.
      Returns:
      Whether this wildcard "can be" another card.
    • getConversions

      public abstract Set<Card> getConversions()
      Gets all the Card that this wildcard can convert to. This is implementation- specific, to different kinds of wildcards in different games.
      Returns:
      The set of all cards that this wildcard can convert to.
      Implementation Note:
      Rationale for this class and this method being abstract: this wildcard should implement the logic to get the conversions by storing additional game state (done by the subclasses), and THEN return the cards it can convert to in a dynamic manner.