|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpoker.Hand
public final class Hand
Stores a Hand of Cards (up to a maximum of 7)
Field Summary | |
---|---|
static int |
MAX_CARDS
|
Constructor Summary | |
---|---|
Hand()
|
|
Hand(Hand h)
Duplicate an existing hand. |
|
Hand(java.lang.String cs)
|
Method Summary | |
---|---|
boolean |
addCard(Card c)
Add a card to the hand. |
boolean |
addCard(int i)
Add a card to the hand. |
void |
addHand(Hand h)
|
void |
clearBadCards()
|
boolean |
contains(Card c)
|
boolean |
equals(Hand h)
Returns true if the hands are identical |
Card |
getCard(int pos)
Get the specified card in the hand |
int[] |
getCardArray()
Obtain the array of card indexes for this hand. |
int |
getCardIndex(int pos)
Get the specified card id |
static java.lang.String |
getCardString(Card c1,
Card c2)
Get a string to represent this starting hand (AA, AKs, QJo, ??, etc...) |
void |
makeEmpty()
Remove the all cards from the hand. |
void |
removeCard()
Remove the last card in the hand. |
void |
removeCard(int i)
Remove the ith card in the hand. |
void |
setCard(int pos,
Card c)
Set the card at pos to the given card |
int |
size()
Get the size of the hand. |
void |
sort()
Bubble Sort the hand to have cards in descending order, but card index. |
java.lang.String |
toString()
Get a string representation of this Hand. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_CARDS
Constructor Detail |
---|
public Hand()
public Hand(java.lang.String cs)
cs
- A string representing a Hand of cardspublic Hand(Hand h)
h
- the hand to clone.Method Detail |
---|
public final int size()
public void removeCard()
public void makeEmpty()
public boolean addCard(Card c)
c
- the card to add
public boolean addCard(int i)
i
- the index value of the card to add
public Card getCard(int pos)
pos
- the position (1..n) of the card in the hand
public int getCardIndex(int pos)
pos
- the position (1..n) of the card in the hand
public void setCard(int pos, Card c)
c
- the card to addpublic int[] getCardArray()
public void sort()
public boolean equals(Hand h)
h
- a hand to compare topublic java.lang.String toString()
toString
in class java.lang.Object
public boolean contains(Card c)
public void addHand(Hand h)
public void clearBadCards()
public void removeCard(int i)
public static java.lang.String getCardString(Card c1, Card c2)
c1
- first hole cardc2
- second hole card
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |