Enum Class Suit

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

public enum Suit extends Enum<Suit>
Represents the four suits in a standard deck of playing cards. Each suit has an associated bitmask value for efficient set operations and a single character symbol for display purposes.
  • Enum Constant Details

    • CLUBS

      public static final Suit CLUBS
      Clubs suit with bitmask value 0x8000 and symbol "c"
    • DIAMONDS

      public static final Suit DIAMONDS
      Diamonds suit with bitmask value 0x4000 and symbol "d"
    • HEARTS

      public static final Suit HEARTS
      Hearts suit with bitmask value 0x2000 and symbol "h"
    • SPADES

      public static final Suit SPADES
      Spades suit with bitmask value 0x1000 and symbol "s"
  • Method Details

    • values

      public static Suit[] 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 Suit 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 bitmask value of this suit.

      The bitmask values are powers of 2 in hexadecimal format, allowing for efficient bitwise operations when working with suit combinations.

      Returns:
      the bitmask value for this suit
    • toString

      public String toString()
      Returns the single character symbol representation of this suit.

      Returns lowercase single character symbols: "c" for CLUBS, "d" for DIAMONDS, "h" for HEARTS, "s" for SPADES.

      Overrides:
      toString in class Enum<Suit>
      Returns:
      the character symbol for this suit