Class CardSuit

java.lang.Object
  |
  +--CardSuit

class CardSuit
extends java.lang.Object

Suit.java - An object that represents the suit of a playing card. This object is immutable, once it is created there is no way to change it - i.e. there are no mutator methods in this class. This class is adapted from the text.

Version:
3/29/2000
Author:
Grant William Braught, Dickinson College

Field Summary
static char CLUBS
          Representation of the clubs suit.
static char DIAMONDS
          Representation of the diamonds suit.
static char HEARTS
          Representation of the hearts suit.
static char SPADES
          Representation of the spades suit.
 
Constructor Summary
(package private) CardSuit(char initSuit)
          Constructor that initializes the suit of the object being created.
 
Method Summary
 char getSuit()
          Get the suit of the calling object.
 java.lang.String toString()
          Return a string representation of the suit.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLUBS

public static final char CLUBS
Representation of the clubs suit.

DIAMONDS

public static final char DIAMONDS
Representation of the diamonds suit.

HEARTS

public static final char HEARTS
Representation of the hearts suit.

SPADES

public static final char SPADES
Representation of the spades suit.
Constructor Detail

CardSuit

CardSuit(char initSuit)
Constructor that initializes the suit of the object being created.
Parameters:
initSuit - the suit of the card.
Method Detail

getSuit

public char getSuit()
Get the suit of the calling object. This will be useful when playing a card game so that the suit of a card can be determined.
Returns:
the suit of the calling object.

toString

public java.lang.String toString()
Return a string representation of the suit.
Returns:
a string representation of the suit.
Overrides:
toString in class java.lang.Object