|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--cardgame.PlayingCard
The PlayingCard class implements a basic card via the Card interface that can be used for various kinds of games. It represents the name, suit, value, front/back images, and visibility of a card, with get and set methods for each.
| Field Summary | |
private java.lang.String |
backImageFileName
The private variable backImageFileName stores the file name that represents the back of a PlayingCard. |
private java.lang.String |
frontImageFileName
The private variable frontImageFileName stores the file name that represents the front of a PlayingCard. |
private java.lang.String |
name
The private variable name represents the common name of a PlayingCard, such as "Ace," "Deuce," or "King." |
private java.lang.String |
suit
The private variable suit represents one of the four standard suits, such as "Heart," "Spade," "Diamond," or "Club." |
private int |
value
The private variable value represents the numerical value of a PlayingCard. |
private boolean |
visibility
The private variable visibility indicates whether a PlayingCard is face up (true) or face down (false). |
| Fields inherited from interface cardgame.Card |
ACE, CLUB, DIAMOND, EIGHT, FIVE, FOUR, HEART, JACK, KING, NINE, QUEEN, SEVEN, SIX, SPADE, TEN, THREE, TWO |
| Constructor Summary | |
PlayingCard()
The no-argument constructor sets the PlayingCard's variables to default values. |
|
PlayingCard(java.lang.String cardName,
java.lang.String cardSuit)
This basic constructor sets the PlayingCard's name and suit. |
|
PlayingCard(java.lang.String cardName,
java.lang.String cardSuit,
int cardValue)
This constructor sets the PlayingCard's name, suit, and value parameters. |
|
PlayingCard(java.lang.String cardName,
java.lang.String cardSuit,
int cardValue,
java.lang.String cardFront,
java.lang.String cardBack)
This constructor sets the PlayingCard's name, suit, front, and back images. |
|
| Method Summary | |
boolean |
equals(Card theOtherPlayingCard)
The public method equals checks whether two PlayingCards have the same name and suit, and returns a boolean result. |
java.lang.String |
getBackImageFileName()
The public method getBackImageFileName returns the file name containing a PlayingCard's back image. |
java.lang.String |
getFrontImageFileName()
The public method getFrontImageFileName returns the file name containing a PlayingCard's front image. |
java.lang.String |
getName()
The public method getName returns the name of a PlayingCard. |
java.lang.String |
getSuit()
The public method getSuit returns the suit of a Card. |
int |
getValue()
The public method getValue returns the numeric value of a PlayingCard. |
boolean |
getVisibility()
The public method getVisibility is used to retrieve the current state of a PlayingCard's visibility. |
void |
setBackImageFileName(java.lang.String backImageFile)
The public method setBackImageFileName specifies the file name containing a PlayingCard's back image. |
void |
setFrontImageFileName(java.lang.String frontImageFile)
The public method setFrontImageFileName specifies the file name containing a PlayingCard's front image. |
void |
setName(java.lang.String cardName)
The public method setName sets the name of a PlayingCard. |
void |
setSuit(java.lang.String cardSuit)
The public method setSuit sets the suit of a PlayingCard. |
void |
setValue(int cardValue)
The public method setValue sets the numeric value of a PlayingCard. |
void |
setVisibility(boolean visible)
The public method setVisibility is used to set a PlayingCard's current state of visibility. |
java.lang.String |
toString()
The public method toString returns the String representation of a PlayingCard, such as "Ace of Spades." |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private java.lang.String name
getName(),
setName(String cardName)private java.lang.String suit
getSuit(),
setSuit(String cardSuit)private int value
getValue(),
setValue(int cardValue)private java.lang.String frontImageFileName
getFrontImageFileName(),
setFrontImageFileName(String frontImageFile)private java.lang.String backImageFileName
getBackImageFileName(),
setBackImageFileName(String backImageFile)private boolean visibility
getVisibility(),
setVisibility(boolean visible)| Constructor Detail |
public PlayingCard()
public PlayingCard(java.lang.String cardName,
java.lang.String cardSuit)
cardName - the name of the PlayingCard as a String.cardSuit - the suit of the PlayingCard as a String.
public PlayingCard(java.lang.String cardName,
java.lang.String cardSuit,
int cardValue)
cardName - the name of the PlayingCard as a String.cardSuit - the suit of the PlayingCard as a String.cardValue - the value of the PlayingCard as an int.
public PlayingCard(java.lang.String cardName,
java.lang.String cardSuit,
int cardValue,
java.lang.String cardFront,
java.lang.String cardBack)
cardName - the name of the PlayingCard as a String.cardSuit - the suit of the PlayingCard as a String.cardValue - the value of the PlayingCard as an int.cardFront - the name of the front image file as a String,
such as "aceofspades.jpg".cardBack - the name of the back image file as a String,
such as "bicycle.jpg".| Method Detail |
public java.lang.String getName()
getName in interface Cardpublic void setName(java.lang.String cardName)
setName in interface CardcardName - the name of a PlayingCard as a String.public java.lang.String getSuit()
getSuit in interface Cardpublic void setSuit(java.lang.String cardSuit)
setSuit in interface CardcardSuit - the suit of a PlayingCard as a String.public int getValue()
getValue in interface Cardpublic void setValue(int cardValue)
setValue in interface CardcardValue - the numeric value of a PlayingCard as an int.public java.lang.String getFrontImageFileName()
getFrontImageFileName in interface Cardpublic void setFrontImageFileName(java.lang.String frontImageFile)
setFrontImageFileName in interface CardfrontImageFile - the String value of the front image file name.public java.lang.String getBackImageFileName()
getBackImageFileName in interface Cardpublic void setBackImageFileName(java.lang.String backImageFile)
setBackImageFileName in interface CardbackImageFile - the String value of the back image file name.public boolean getVisibility()
getVisibility in interface Cardpublic void setVisibility(boolean visible)
setVisibility in interface Cardvisible - the boolean value true (face up) or false (face down).public java.lang.String toString()
toString in interface CardtoString in class java.lang.Objectpublic boolean equals(Card theOtherPlayingCard)
equals in interface CardtheOtherCard - - the PlayingCard to be compared with this PlayingCard.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||