|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectCard
public class Card
This class models a single, ordinary playing card, which possesses a rank and a suit or else is a "suitless" joker.
| Field Summary | |
|---|---|
static int |
ACE
|
static int |
CLUBS
|
static int |
DEUCE
|
static int |
DIAMONDS
|
static int |
EIGHT
|
static int |
FIVE
|
static int |
FOUR
|
static int |
HEARTS
|
static int |
JACK
|
static int |
JOKER
|
static int |
KING
|
static int |
KNAVE
|
static int |
NINE
|
static int |
NO_SUIT
|
static int |
QUEEN
|
static int |
SEVEN
|
static int |
SIX
|
static int |
SPADES
|
static int |
TEN
|
static int |
THREE
|
static int |
TREY
|
static int |
TWO
|
| Constructor Summary | |
|---|---|
Card(int r)
Constructs a joker. |
|
Card(int r,
int s)
Constructs a card with rank r and suit s (guaranteed not to be a joker). |
|
| Method Summary | |
|---|---|
int |
compareTo(Card c)
Returns the distance between this card and c in a new, joker-less deck. |
boolean |
equals(java.lang.Object c)
Returns true iff this card is equivalent to c, with jokers allowed. |
boolean |
isJoker()
Returns true iff this card is a joker. |
int |
rank()
Returns this card's rank. |
java.lang.String |
rankName()
Returns a string representing this card's rank. |
int |
suit()
Returns this card's suit (or Card.NO_SUIT in the event of a joker). |
java.lang.String |
suitName()
Returns a string representing this card's suit (or empty string in the event of Card.NO_SUIT). |
java.lang.String |
toString()
Returns a string representing this card's name. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int JOKER
public static final int ACE
public static final int TWO
public static final int DEUCE
public static final int THREE
public static final int TREY
public static final int FOUR
public static final int FIVE
public static final int SIX
public static final int SEVEN
public static final int EIGHT
public static final int NINE
public static final int TEN
public static final int JACK
public static final int KNAVE
public static final int QUEEN
public static final int KING
public static final int NO_SUIT
public static final int SPADES
public static final int HEARTS
public static final int DIAMONDS
public static final int CLUBS
| Constructor Detail |
|---|
public Card(int r,
int s)
public Card(int r)
| Method Detail |
|---|
public int suit()
public int rank()
public java.lang.String rankName()
public java.lang.String suitName()
public java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(Card c)
public boolean isJoker()
public boolean equals(java.lang.Object c)
equals in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||