Class Suit

java.lang.Object
  |
  +--Suit
All Implemented Interfaces:
java.lang.Comparable

public final class Suit
extends java.lang.Object
implements java.lang.Comparable

Specification of the suit values for a standard deck of cards.


Field Summary
static Suit CLUBS
          The suit clubs.
static Suit DIAMONDS
          The suit diamonds.
static Suit HEARTS
          The suit hearts.
static Suit SPADES
          The suit spades.
static java.util.List VALUES
          List of all suit values.
 
Method Summary
 int compareTo(java.lang.Object otherSuitObject)
          Compares the suits.
 java.lang.String getName()
          Returns a description of this suit.
 java.lang.String getSymbol()
          The symbol associated with this suit.
 java.lang.String toString()
          Returns a description of this suit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLUBS

public static final Suit CLUBS
The suit clubs.

DIAMONDS

public static final Suit DIAMONDS
The suit diamonds.

HEARTS

public static final Suit HEARTS
The suit hearts.

SPADES

public static final Suit SPADES
The suit spades.

VALUES

public static final java.util.List VALUES
List of all suit values. Primarily for use with iteration.
Method Detail

getName

public java.lang.String getName()
Returns a description of this suit.
Returns:
the name of the suit.

getSymbol

public java.lang.String getSymbol()
The symbol associated with this suit. Returns the symbol, which usually constitutes a single character, in the form of a string. Symbol is used for the construction of the filenames of the card images.
Returns:
string containing the symbol for the suit.

toString

public java.lang.String toString()
Returns a description of this suit.
Overrides:
toString in class java.lang.Object
Returns:
the name of this suit.

compareTo

public int compareTo(java.lang.Object otherSuitObject)
Compares the suits. Used for the purpose of sorting cards in a hand or deck.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
otherSuitObject - the other suit.
Returns:
< 0 if this suit is lower than the other suit, 0 if the suits are the same, or > 0 if this suit is higher than the other suit.