Package loveletter
Enum Card
- java.lang.Object
-
- java.lang.Enum<Card>
-
- loveletter.Card
-
-
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 generatorstatic Card[]
deal(java.util.Random rand)
Creates a shuffled deck of cardsjava.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.
-
-
-
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 namejava.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 classjava.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.
-
-