public class Card
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
NUM_CARDS
the number of cards in the 52-card French deck
|
static int |
NUM_RANKS
the number of ranks in the 52-card French deck
|
static int |
NUM_SUITS
the number of suits in the 52-card French deck
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Card other)
Return whether or not this card equals another Card object.
|
static Card[] |
getAllCards()
Get an array containing all cards.
|
static Card |
getCard(int cardId)
Get the Card object associated with the given card identification integer.
|
static Card |
getCard(java.lang.String cardString)
Given a Card String representation, return the associated Card.
|
int |
getCardId()
Return unique integer card identification number according to "suit-major" ordering where cards are ordered
A, 2, ..., K within suits that are ordered alphabetically.
|
int |
getRank()
Get Card rank.
|
static java.lang.String[] |
getRankNames()
Return an array of Strings with the single-character rank names.
|
int |
getSuit()
Get Card suit.
|
static java.lang.String[] |
getSuitNames()
Return an array of Strings with the single-character suit names.
|
boolean |
isAce()
Return whether or not the card is an ace.
|
static void |
main(java.lang.String[] args)
Print all card objects.
|
java.lang.String |
toString() |
public static final int NUM_RANKS
public static final int NUM_SUITS
public static final int NUM_CARDS
public static java.lang.String[] getRankNames()
public static java.lang.String[] getSuitNames()
public static Card getCard(java.lang.String cardString)
cardString
- card String representationpublic static Card getCard(int cardId)
cardId
- the unique integer identification number for the desired cardpublic static Card[] getAllCards()
public int getRank()
public int getSuit()
public boolean isAce()
public int getCardId()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(Card other)
other
- the other Card object being tested for equality.public static void main(java.lang.String[] args)
args
- (not used)