Package com.github.jmp.poker
Enum Class Rank
- All Implemented Interfaces:
Serializable,Comparable<Rank>,Constable
Represents the rank of a playing card in standard deck order.
Ranks are ordered from lowest to highest value: TWO (0) through ACE (12).
This enum provides methods for converting between different representations
of card ranks including string notation, numeric values, and enum constants.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAce - highest rank with value 12Eight - rank with value 6Five - rank with value 3Four - rank with value 2Jack - rank with value 9King - rank with value 11Nine - rank with value 7Queen - rank with value 10Seven - rank with value 5Six - rank with value 4Ten - rank with value 8Three - rank with value 1Two - lowest rank with value 0 -
Method Summary
Modifier and TypeMethodDescriptionintgetValue()Returns the numeric value of this rank.toString()Returns the string representation of this rank.static RankReturns the enum constant of this class with the specified name.static Rank[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
TWO
Two - lowest rank with value 0 -
THREE
Three - rank with value 1 -
FOUR
Four - rank with value 2 -
FIVE
Five - rank with value 3 -
SIX
Six - rank with value 4 -
SEVEN
Seven - rank with value 5 -
EIGHT
Eight - rank with value 6 -
NINE
Nine - rank with value 7 -
TEN
Ten - rank with value 8 -
JACK
Jack - rank with value 9 -
QUEEN
Queen - rank with value 10 -
KING
King - rank with value 11 -
ACE
Ace - highest rank with value 12
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
getValue
public int getValue()Returns the numeric value of this rank.- Returns:
- the numeric value (0 for TWO, 12 for ACE)
-
toString
Returns the string representation of this rank.Uses standard card notation: "2"-"9" for number cards, "T" for Ten, "J" for Jack, "Q" for Queen, "K" for King, "A" for Ace.
-