Package javatro.storage.utils
Class CardUtils
java.lang.Object
javatro.storage.utils.CardUtils
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Ante.BlindblindFromKey(String key) Converts a storage key into anAnte.Blindobject.static StringcardToString(Card card) Converts aCardto a string representation.static Deck.DeckTypedeckFromKey(String key) Converts a storage key into aDeck.DeckTypeobject.static DeckArtfromStorageKey(String key) Converts a storage key into aDeckArtobject.static booleanisValidCardString(String cardString) Validates if a given card string is in the correct format.static booleanisValidJokerString(String jokerName) Validates if a given joker name is valid.static StringjokerToString(Joker joker) Converts aJokerobject to its string representation.static CardparseCardString(String cardString) Parses a card string into aCardobject.static JokerparseJokerString(String jokerName) Parses a joker name string into aJokerobject.
-
Constructor Details
-
CardUtils
public CardUtils()
-
-
Method Details
-
fromStorageKey
Converts a storage key into aDeckArtobject.- Parameters:
key- The key representing the deck type.- Returns:
- The corresponding
DeckArt. - Throws:
IllegalArgumentException- If the key is invalid.
-
deckFromKey
Converts a storage key into aDeck.DeckTypeobject.- Parameters:
key- The key representing the deck type.- Returns:
- The corresponding
Deck.DeckType. - Throws:
IllegalArgumentException- If the key is invalid.
-
blindFromKey
Converts a storage key into anAnte.Blindobject.- Parameters:
key- The key representing the blind type.- Returns:
- The corresponding
Ante.Blind. - Throws:
IllegalArgumentException- If the key is invalid.
-
parseCardString
Parses a card string into aCardobject.- Parameters:
cardString- The card string to parse.- Returns:
- The corresponding
Card. - Throws:
IllegalArgumentException- If the card string is invalid.
-
cardToString
Converts aCardto a string representation.- Parameters:
card- TheCardto convert.- Returns:
- The string representation of the card.
-
isValidCardString
Validates if a given card string is in the correct format.- Parameters:
cardString- The card string to validate.- Returns:
trueif the card string is valid, otherwisefalse.
-
parseJokerString
Parses a joker name string into aJokerobject.- Parameters:
jokerName- The name of the joker.- Returns:
- The corresponding
Jokerobject.
-
jokerToString
Converts aJokerobject to its string representation.- Parameters:
joker- TheJokerobject to convert.- Returns:
- The string representation of the
Joker. - Throws:
IllegalArgumentException- if the joker is null.
-
isValidJokerString
Validates if a given joker name is valid.- Parameters:
jokerName- The name of the joker to validate.- Returns:
trueif the name is valid, otherwisefalse.
-