Class CardUtils

java.lang.Object
javatro.storage.utils.CardUtils

public class CardUtils extends Object
The CardUtils class provides utility methods for handling cards, decks, blinds, and jokers in the Javatro application. It provides various conversion, parsing, and validation functionalities.

This class is designed to be used statically and should not be instantiated.

  • Constructor Details

    • CardUtils

      public CardUtils()
  • Method Details

    • fromStorageKey

      public static DeckArt fromStorageKey(String key)
      Converts a storage key into a DeckArt object.
      Parameters:
      key - The key representing the deck type.
      Returns:
      The corresponding DeckArt.
      Throws:
      IllegalArgumentException - If the key is invalid.
    • deckFromKey

      public static Deck.DeckType deckFromKey(String key)
      Converts a storage key into a Deck.DeckType object.
      Parameters:
      key - The key representing the deck type.
      Returns:
      The corresponding Deck.DeckType.
      Throws:
      IllegalArgumentException - If the key is invalid.
    • blindFromKey

      public static Ante.Blind blindFromKey(String key)
      Converts a storage key into an Ante.Blind object.
      Parameters:
      key - The key representing the blind type.
      Returns:
      The corresponding Ante.Blind.
      Throws:
      IllegalArgumentException - If the key is invalid.
    • parseCardString

      public static Card parseCardString(String cardString)
      Parses a card string into a Card object.
      Parameters:
      cardString - The card string to parse.
      Returns:
      The corresponding Card.
      Throws:
      IllegalArgumentException - If the card string is invalid.
    • cardToString

      public static String cardToString(Card card)
      Converts a Card to a string representation.
      Parameters:
      card - The Card to convert.
      Returns:
      The string representation of the card.
    • isValidCardString

      public static boolean isValidCardString(String cardString)
      Validates if a given card string is in the correct format.
      Parameters:
      cardString - The card string to validate.
      Returns:
      true if the card string is valid, otherwise false.
    • parseJokerString

      public static Joker parseJokerString(String jokerName)
      Parses a joker name string into a Joker object.
      Parameters:
      jokerName - The name of the joker.
      Returns:
      The corresponding Joker object.
    • jokerToString

      public static String jokerToString(Joker joker)
      Converts a Joker object to its string representation.
      Parameters:
      joker - The Joker object to convert.
      Returns:
      The string representation of the Joker.
      Throws:
      IllegalArgumentException - if the joker is null.
    • isValidJokerString

      public static boolean isValidJokerString(String jokerName)
      Validates if a given joker name is valid.
      Parameters:
      jokerName - The name of the joker to validate.
      Returns:
      true if the name is valid, otherwise false.