Enum Class Rank

java.lang.Object
java.lang.Enum<Rank>
com.github.jmp.poker.Rank
All Implemented Interfaces:
Serializable, Comparable<Rank>, Constable

public enum Rank extends Enum<Rank>
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.
  • Enum Constant Details

    • TWO

      public static final Rank TWO
      Two - lowest rank with value 0
    • THREE

      public static final Rank THREE
      Three - rank with value 1
    • FOUR

      public static final Rank FOUR
      Four - rank with value 2
    • FIVE

      public static final Rank FIVE
      Five - rank with value 3
    • SIX

      public static final Rank SIX
      Six - rank with value 4
    • SEVEN

      public static final Rank SEVEN
      Seven - rank with value 5
    • EIGHT

      public static final Rank EIGHT
      Eight - rank with value 6
    • NINE

      public static final Rank NINE
      Nine - rank with value 7
    • TEN

      public static final Rank TEN
      Ten - rank with value 8
    • JACK

      public static final Rank JACK
      Jack - rank with value 9
    • QUEEN

      public static final Rank QUEEN
      Queen - rank with value 10
    • KING

      public static final Rank KING
      King - rank with value 11
    • ACE

      public static final Rank ACE
      Ace - highest rank with value 12
  • Method Details

    • values

      public static Rank[] 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

      public static Rank valueOf(String name)
      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 name
      NullPointerException - 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

      public String 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.

      Overrides:
      toString in class Enum<Rank>
      Returns:
      the string representation of this rank