cardgame
Interface Card

All Known Implementing Classes:
PlayingCard

public interface Card

The Card interface defines a basic card that can be used in various kinds of games. It represents the name, suit, value, and front/back images of a card. It also defines useful constants for card names and suits.

Version:
1.0, 15 July 2001
Author:
James A. Webb, www.uberkode.com

Field Summary
static java.lang.String ACE
          This value represents the card name "Ace"
static java.lang.String CLUB
          This value represents the card suit "Club"
static java.lang.String DIAMOND
          This value represents the card suit "Diamond"
static java.lang.String EIGHT
          This value represents the card name "Eight"
static java.lang.String FIVE
          This value represents the card name "Five"
static java.lang.String FOUR
          This value represents the card name "Four"
static java.lang.String HEART
          This value represents the card suit "Heart"
static java.lang.String JACK
          This value represents the card name "Jack"
static java.lang.String KING
          This value represents the card name "King"
static java.lang.String NINE
          This value represents the card name "Nine"
static java.lang.String QUEEN
          This value represents the card name "Queen"
static java.lang.String SEVEN
          This value represents the card name "Seven"
static java.lang.String SIX
          This value represents the card name "Six"
static java.lang.String SPADE
          This value represents the card suit "Spade"
static java.lang.String TEN
          This value represents the card name "Ten"
static java.lang.String THREE
          This value represents the card name "Three"
static java.lang.String TWO
          This value represents the card name "Two"
 
Method Summary
 boolean equals(Card theOtherCard)
          The public method equals checks whether two Cards have the same name and suit, and returns a boolean result.
 java.lang.String getBackImageFileName()
          The public method getBackImageFileName returns the file name containing the Card's back image.
 java.lang.String getFrontImageFileName()
          The public method getFrontImageFileName returns the file name containing the Card's front image.
 java.lang.String getName()
          The public method getName returns the name of the Card.
 java.lang.String getSuit()
          The public method getSuit returns the suit of the Card.
 int getValue()
          The public method getValue returns the numeric value of the Card.
 boolean getVisibility()
          The public method getVisibility is used to retrieve the current state of a Card's visibility.
 void setBackImageFileName(java.lang.String backImageFile)
          The public method setBackImageFileName specifies the file name containing the Card's back image.
 void setFrontImageFileName(java.lang.String frontImageFile)
          The public method setFrontImageFileName specifies the file name containing the Card's front image.
 void setName(java.lang.String cardName)
          The public method setName sets the name of the Card.
 void setSuit(java.lang.String cardSuit)
          The public method setSuit sets the suit of the Card.
 void setValue(int cardValue)
          The public method setValue sets the numeric value of the Card.
 void setVisibility(boolean visible)
          The public method setVisibility is used to set a Card's current state of visibility.
 java.lang.String toString()
          The public method toString returns the String representation of the Card, such as "Ace of Spades."
 

Field Detail

ACE

public static final java.lang.String ACE
This value represents the card name "Ace"

TWO

public static final java.lang.String TWO
This value represents the card name "Two"

THREE

public static final java.lang.String THREE
This value represents the card name "Three"

FOUR

public static final java.lang.String FOUR
This value represents the card name "Four"

FIVE

public static final java.lang.String FIVE
This value represents the card name "Five"

SIX

public static final java.lang.String SIX
This value represents the card name "Six"

SEVEN

public static final java.lang.String SEVEN
This value represents the card name "Seven"

EIGHT

public static final java.lang.String EIGHT
This value represents the card name "Eight"

NINE

public static final java.lang.String NINE
This value represents the card name "Nine"

TEN

public static final java.lang.String TEN
This value represents the card name "Ten"

JACK

public static final java.lang.String JACK
This value represents the card name "Jack"

QUEEN

public static final java.lang.String QUEEN
This value represents the card name "Queen"

KING

public static final java.lang.String KING
This value represents the card name "King"

HEART

public static final java.lang.String HEART
This value represents the card suit "Heart"

SPADE

public static final java.lang.String SPADE
This value represents the card suit "Spade"

DIAMOND

public static final java.lang.String DIAMOND
This value represents the card suit "Diamond"

CLUB

public static final java.lang.String CLUB
This value represents the card suit "Club"
Method Detail

getName

public java.lang.String getName()
The public method getName returns the name of the Card.
Returns:
the name of the Card as a String.

setName

public void setName(java.lang.String cardName)
The public method setName sets the name of the Card.
Parameters:
cardName - the name of the Card as a String.

getSuit

public java.lang.String getSuit()
The public method getSuit returns the suit of the Card.
Returns:
the suit of the Card as a String.

setSuit

public void setSuit(java.lang.String cardSuit)
The public method setSuit sets the suit of the Card.
Parameters:
cardSuit - the suit of the Card as a String.

getValue

public int getValue()
The public method getValue returns the numeric value of the Card.
Returns:
the value of the Card as an int.

setValue

public void setValue(int cardValue)
The public method setValue sets the numeric value of the Card.
Parameters:
cardValue - the numeric value of the Card as an int.

getFrontImageFileName

public java.lang.String getFrontImageFileName()
The public method getFrontImageFileName returns the file name containing the Card's front image.
Returns:
the String value of the front image file name.

setFrontImageFileName

public void setFrontImageFileName(java.lang.String frontImageFile)
The public method setFrontImageFileName specifies the file name containing the Card's front image.
Parameters:
FrontImageFileName - the String value of the front image file name.

getBackImageFileName

public java.lang.String getBackImageFileName()
The public method getBackImageFileName returns the file name containing the Card's back image.
Returns:
the String value of the back image file name.

setBackImageFileName

public void setBackImageFileName(java.lang.String backImageFile)
The public method setBackImageFileName specifies the file name containing the Card's back image.
Parameters:
FrontImageFileName - the String value of the back image file name.

getVisibility

public boolean getVisibility()
The public method getVisibility is used to retrieve the current state of a Card's visibility. The boolean true represents face up and the boolean false represents face down.
Returns:
the boolean value representing the Card's visibility state.

setVisibility

public void setVisibility(boolean visible)
The public method setVisibility is used to set a Card's current state of visibility. Face up is represented by the boolean true and face down is represented by the boolean false. The default condition of a Card is face down.
Parameters:
visible - the boolean value true (face up) or false (face down).

toString

public java.lang.String toString()
The public method toString returns the String representation of the Card, such as "Ace of Spades."
Overrides:
toString in class java.lang.Object
Returns:
the textual representation of the Card as a String.

equals

public boolean equals(Card theOtherCard)
The public method equals checks whether two Cards have the same name and suit, and returns a boolean result.
Parameters:
theOtherCard - - the Card to be compared with this Card.
Returns:
the boolean result of the comparison.