Package loveletter

Enum Card

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<Card>

    public enum Card
    extends java.lang.Enum<Card>
    An enumeration of the card types Cards are immutable
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int count()  
      static Card[] deal()
      Creates a shuffled deck of cards, using a default random number generator
      static Card[] deal​(java.util.Random rand)
      Creates a shuffled deck of cards
      java.lang.String toString()  
      int value()  
      static Card valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static Card[] 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, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
      • Methods inherited from class java.lang.Object

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

      • GUARD

        public static final Card GUARD
      • PRIEST

        public static final Card PRIEST
      • BARON

        public static final Card BARON
      • HANDMAID

        public static final Card HANDMAID
      • PRINCE

        public static final Card PRINCE
      • KING

        public static final Card KING
      • COUNTESS

        public static final Card COUNTESS
      • PRINCESS

        public static final Card PRINCESS
    • Method Detail

      • values

        public static Card[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (Card c : Card.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static Card 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
      • value

        public int value()
        Returns:
        the value of the card
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Enum<Card>
        Returns:
        the name of the card
      • count

        public int count()
        Returns:
        the number of times the card appears in the deck
      • deal

        public static Card[] deal​(java.util.Random rand)
        Creates a shuffled deck of cards
        Parameters:
        rand - a random number generator to shuffle the deck
        Returns:
        an array of cards representing a standard deck of loveletter cards, in random order.
      • deal

        public static Card[] deal()
        Creates a shuffled deck of cards, using a default random number generator
        Returns:
        an array of cards representing a standard deck of loveletter cards, in random order.