Enum Card.Rank
java.lang.Object
java.lang.Enum<Card.Rank>
Card.Rank
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<Card.Rank>
- Enclosing class:
- Card
public static enum Card.Rank
- extends java.lang.Enum<Card.Rank>
Rank enum to name the card. In 304, there are only 8 cares used in each Suit.
And this enum has a methos called points to return the point value of a pertuculer card.
In this case,
Card Points
J (JACK) 30
9 (NINE) 20
A (ACE) 11
10 (TEN) 10
K (KING) 3
Q (QUEEN) 2
8 (EIGHT) 0
7 (SEVEN) 0
Field Summary |
private int |
points
|
Method Summary |
int |
points()
returns the point value of a perticular card rank. |
static Card.Rank |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static Card.Rank[] |
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, toString, valueOf |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
JACK
public static final Card.Rank JACK
NINE
public static final Card.Rank NINE
ACE
public static final Card.Rank ACE
TEN
public static final Card.Rank TEN
KING
public static final Card.Rank KING
QUEEN
public static final Card.Rank QUEEN
EIGHT
public static final Card.Rank EIGHT
SEVEN
public static final Card.Rank SEVEN
points
private final int points
values
public static Card.Rank[] 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.Rank c : Card.Rank.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.Rank 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.)
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified name
java.lang.NullPointerException
- if the argument is null- Parameters:
name
- the name of the enum constant to be returned.
- Returns:
- the enum constant with the specified name
points
public int points()
- returns the point value of a perticular card rank.