Enum Suit

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Suit>, java.lang.constant.Constable

    public enum Suit
    extends java.lang.Enum<Suit>
    Defines the four suits of a standard card game.
    Since:
    16.08.2016 18:19:20
    Author:
    Nico Danneberg
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.lang.Enum

        java.lang.Enum.EnumDesc<E extends java.lang.Enum<E>>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CLUBS
      The four values with an internal representation as powers of two.
      DIAMONDS  
      HEARTS  
      SPADES  
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int value
      Stores the internal numeric value.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Suit​(int val)
      Creates a new suit but only by internal access.
    • Method Summary

      Modifier and Type Method Description
      int getValue()
      Just returns the numeric value.
      static Suit valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Suit[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, describeConstable, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • CLUBS

        public static final Suit CLUBS
        The four values with an internal representation as powers of two.
      • HEARTS

        public static final Suit HEARTS
      • SPADES

        public static final Suit SPADES
      • DIAMONDS

        public static final Suit DIAMONDS
    • Field Detail

      • value

        private int value
        Stores the internal numeric value.
    • Constructor Detail

      • Suit

        private Suit​(int val)
        Creates a new suit but only by internal access.
        Parameters:
        val - the numeric value of the new suit
        See Also:
        value
    • Method Detail

      • values

        public static Suit[] values()
        Returns an array containing the constants of this enum type, in the order they are declared.
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Suit valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getValue

        public int getValue()
        Just returns the numeric value.
        Returns:
        the numeric value