ps0.optional
Enum CardValue

java.lang.Object
  extended by java.lang.Enum<CardValue>
      extended by ps0.optional.CardValue
All Implemented Interfaces:
Serializable, Comparable<CardValue>

public enum CardValue
extends Enum<CardValue>

Represents one of 13 values (2-10, Jack, Queen, King, Ace) that appear on a playing card. This class is immutable.


Enum Constant Summary
Enum Constant and Description
ACE
          The card value representing an Ace.
EIGHT
          The card value representing 8.
FIVE
          The card value representing 5.
FOUR
          The card value representing 4.
JACK
          The card value representing a Jack.
KING
          The card value representing a King.
NINE
          The card value representing 9.
QUEEN
          The card value representing a Queen.
SEVEN
          The card value representing 7.
SIX
          The card value representing 6.
TEN
          The card value representing 10.
THREE
          The card value representing 3.
TWO
          The card value representing 2.
 
Method Summary
Modifier and Type Method and Description
 String getLetterOnCard()
          Returns the symbol representing this card value.
 String getName()
          Returns the name of this value.
 String toString()
          Returns a description of this value.
static CardValue valueOf(String name)
          Returns the enum constant of this type with the specified name.
static CardValue[] 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

TWO

public static final CardValue TWO
The card value representing 2.


THREE

public static final CardValue THREE
The card value representing 3.


FOUR

public static final CardValue FOUR
The card value representing 4.


FIVE

public static final CardValue FIVE
The card value representing 5.


SIX

public static final CardValue SIX
The card value representing 6.


SEVEN

public static final CardValue SEVEN
The card value representing 7.


EIGHT

public static final CardValue EIGHT
The card value representing 8.


NINE

public static final CardValue NINE
The card value representing 9.


TEN

public static final CardValue TEN
The card value representing 10.


JACK

public static final CardValue JACK
The card value representing a Jack.


QUEEN

public static final CardValue QUEEN
The card value representing a Queen.


KING

public static final CardValue KING
The card value representing a King.


ACE

public static final CardValue ACE
The card value representing an Ace.

Method Detail

values

public static CardValue[] 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 (CardValue c : CardValue.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static CardValue valueOf(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:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getName

public String getName()
Returns the name of this value.

The value names can be either "2", "3", ..., "10", "Jack", "Queen", "King", or "Ace".

Effects:
returns the name of this value

getLetterOnCard

public String getLetterOnCard()
Returns the symbol representing this card value.

For the values 2-10, this symbol is simply the digits themselves; for JACK, QUEEN, KING, and ACE values, the symbols are "J", "Q", "K", and "A" respectively.

Effects:
returns the symbol representing this card value

toString

public String toString()
Returns a description of this value.

Overrides:
toString in class Enum<CardValue>
Effects:
returns a description of this value