|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectCard
GameCard
public class GameCard
Represents a playing card that can be either face up or face down. The playing card has a face value, a suit, and a suit color (red or black), Bugs: none known
Field Summary | |
---|---|
static boolean |
BLACK
Represents the suit color black (for clubs and spades). |
static boolean |
RED
Represents the suit color red (for diamonds and hearts). |
Fields inherited from class Card |
---|
CLUBS, DIAMONDS, HEARTS, SPADES |
Constructor Summary | |
---|---|
GameCard(Card card,
boolean faceUp)
Constructs a GameCard object with the same face value and suit value as the Card object given. |
|
GameCard(int face,
int suit,
boolean faceUp)
Constructs a GameCard object with the given face value and suit value. |
Method Summary | |
---|---|
void |
flip()
Flips the card, either from face up to face down or vice versa. |
boolean |
getSuitColor()
Returns the suit color of the card. |
boolean |
isFaceUp()
Returns true if the card is face up and false otherwise. |
boolean |
match(GameCard otherCard)
Returns true if this card matches the given card and false otherwise. |
java.lang.String |
toString()
Returns a String representing the game card. |
Methods inherited from class Card |
---|
getFace, getSuit |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final boolean RED
public static final boolean BLACK
Constructor Detail |
---|
public GameCard(int face, int suit, boolean faceUp)
face
- the face value of the cardsuit
- the suit of the cardfaceUp
- a boolean indicating if the card is face uppublic GameCard(Card card, boolean faceUp)
card
- the card whose face value and suit value to copyfaceUp
- a boolean indicating if the card is face upMethod Detail |
---|
public boolean getSuitColor()
public boolean isFaceUp()
public void flip()
public boolean match(GameCard otherCard)
otherCard
- the card to compare
public java.lang.String toString()
toString
in class Card
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |