|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.asdf.plugins.pokergames.Card
public class Card
A class to efficiently represent a traditional playing card from a 52 card deck.
Field Summary | |
---|---|
int |
card
|
static int[] |
primes
|
Constructor Summary | |
---|---|
Card()
Default constructor. |
|
Card(int card_)
Constructs a card with the given integer representation. |
|
Card(int rank,
int suit)
Constructs a card with given rank and suit. |
Method Summary | |
---|---|
int |
compareTo(Card a)
Compares this card to another card. |
int |
getInt()
Getter for integer representation of the card. |
boolean |
isValid()
Checks if the card is a valid card |
boolean |
lessThan(Card anotherCard)
Comparator function. |
int |
rank()
Getter function for card rank. |
int |
suit()
Getter function for card suit. |
void |
swap(Card a)
Swaps the contents of two cards |
java.lang.String |
toString()
Creates a string representation of the card. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int card
public static int[] primes
Constructor Detail |
---|
public Card()
public Card(int card_)
card_
- integer representation of the card.public Card(int rank, int suit)
rank
- Rank is a value from [0-12] and describes the rank of the card.suit
- Suit is an integer from [0-3].Method Detail |
---|
public int compareTo(Card a)
a
- Another card.
public boolean lessThan(Card anotherCard)
anotherCard
- A card to which we will compare this card.
public boolean isValid()
public int rank()
public int suit()
public void swap(Card a)
a
- Another card with which the contents of this card will be swapped.public int getInt()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |