|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCard
public class Card
This class represents a Card object.
Obtaining suit, rank, and many boolean statements is what this class can be used for. Other values can be extended through this class.
When intiated a Card must be passed the suit, either red or black (character sensitive, not case sensitive), and a specific rank.
| Field Summary | |
|---|---|
static java.lang.String |
CLUB
|
static java.lang.String |
DIAMOND
|
static java.lang.String |
HEART
|
static int |
MAX_RANK
|
static java.lang.String |
SPADE
|
| Fields inherited from interface IGuiCard |
|---|
CLUBS, DIAMONDS, HEARTS, rankPrefixes, SPADES, suitPrefixes |
| Constructor Summary | |
|---|---|
Card(java.lang.String suit,
int rank)
Constructs a Card |
|
| Method Summary | |
|---|---|
boolean |
alternateSuit(Card c)
Checks to make certain that the card you have and the one you want to compare it to are of alternate suits. |
boolean |
alternateSuit(java.lang.String suit)
Checks to make certain that the card you have has an alternate suit to the suit you are comparing it to. |
boolean |
checkRank(Card c)
If you want to check a Card Object's rank versus the one you currently have, this is the method you want to use |
boolean |
checkRank(int r)
If you want to check a rank versus the one you currently have, this is the method you want to use |
java.lang.String |
getCardId()
Converts a card into printable format, by changing the rank of the card into a string, and concatenating it to the suit. |
int |
getRank()
Obtains the rank of the Card Object |
java.lang.String |
getSuit()
Obtains the suit of the Card Object |
boolean |
isFaceUp()
Return true when the card is face up, and false otherwise. |
boolean |
isOneHigher(Card card)
Method observes the rank of two cards and compares them. |
boolean |
isOneLower(Card card)
Method observes the rank of two cards and compares them. |
boolean |
isValidRank(int rank)
Returns a boolean whether or not the rank of a given card is higher than the highest rank we pass in the program |
boolean |
isValidSuit(java.lang.String suit)
Checks to see whether or not the card is actually a certain suit |
static void |
main(java.lang.String[] args)
Main method, tests whether there are bugs in class |
boolean |
sameSuit(Card c)
Method used to check whether or not your card has the same suit as the card you are currently comparing it to. |
boolean |
sameSuit(java.lang.String s)
Method used to check whether or not your card has the same suit as suit s. |
void |
setInvisible()
|
void |
setVisible()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String CLUB
public static final java.lang.String DIAMOND
public static final java.lang.String HEART
public static final java.lang.String SPADE
public static final int MAX_RANK
| Constructor Detail |
|---|
public Card(java.lang.String suit,
int rank)
suit - is the String that is passed, it should be either red or blackrank - is the rank that is passed| Method Detail |
|---|
public boolean isValidSuit(java.lang.String suit)
suit - a string that is considered a suit
public boolean isValidRank(int rank)
rank - an int that is passed into the method
public java.lang.String getSuit()
public int getRank()
public boolean checkRank(Card c)
c - is the Card you want to compare to your current Card
public boolean checkRank(int r)
r - is the rank you want to compare to myRank
public boolean sameSuit(Card c)
c - is the Card you want to compare to your current Card
public boolean sameSuit(java.lang.String s)
s - is the suit you are comparing against
public boolean alternateSuit(Card c)
c - is the Card you want to compare to your current Card
public boolean alternateSuit(java.lang.String suit)
suit - is the suit you want to compare to your
current Card's suit
public boolean isOneLower(Card card)
card - is the Card you want to compare to your current Card
public boolean isOneHigher(Card card)
card - is the Card you want to compare to your current Card
public java.lang.String getCardId()
getCardId in interface IGuiCardpublic static void main(java.lang.String[] args)
public boolean isFaceUp()
IGuiCard
isFaceUp in interface IGuiCardpublic void setVisible()
public void setInvisible()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||