|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectglassfrog.model.Hand
public class Hand
The Hand class is used to represent a set of cards for the players and the board. More specifically, a Hand is the set of all the private cards for all of the players over all of the rounds and the set of public cards for all of the rounds. Use: To store hands dealt from the deck and give string representations of those hands for evaluation.
Field Summary | |
---|---|
private int |
numPlayers
|
private int[] |
numPrivateCards
|
private int[] |
numPublicCards
|
private int |
numRounds
|
private java.util.ArrayList<Card>[][] |
privateCards
|
private java.util.ArrayList<Card>[] |
publicCards
|
Constructor Summary | |
---|---|
Hand()
Default constructor. |
|
Hand(int numPlayers,
int numRounds,
java.util.ArrayList<Card>[] publicCards,
java.util.ArrayList<Card>[][] privateCards)
Used to preset a hand with given cards |
|
Hand(int numPlayers,
int numRounds,
int[] numPrivateCards,
int[] numPublicCards)
Good constructor. |
Method Summary | |
---|---|
java.lang.String |
boardToString()
Returns the board cards for a given hand, space delimited. |
java.lang.String |
getEvaluationString(int player)
Return the hand for the given player (only thier private cards) and all public cards. |
java.util.ArrayList<Card> |
getPrivateCards(int player,
int round)
Return the private cards for a player for the given hand in a given round |
java.lang.String |
getPrivateCardsString(int player,
int round)
Return the cards for a player for a given round |
java.util.ArrayList<Card> |
getPublicCards(int round)
Return the public cards for a given round |
java.lang.String |
getPublicCardsString(int round)
Return the public cards for a given round |
private void |
initializeCardArrays()
Initializes the public and private card arrays with to the proper sizes |
void |
setPrivateCards(java.util.ArrayList<Card>[][] privateCards)
Set the private cards for a specific player |
void |
setPublicCards(java.util.ArrayList<Card>[] publicCards)
Set the public card array for the hand |
java.lang.String |
toString()
Override of the toString method for easy to read hand representation. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int numRounds
private int numPlayers
private int[] numPrivateCards
private int[] numPublicCards
private java.util.ArrayList<Card>[] publicCards
private java.util.ArrayList<Card>[][] privateCards
Constructor Detail |
---|
public Hand()
public Hand(int numPlayers, int numRounds, int[] numPrivateCards, int[] numPublicCards)
numPlayers
- numRounds
- numPrivateCards
- numPublicCards
- public Hand(int numPlayers, int numRounds, java.util.ArrayList<Card>[] publicCards, java.util.ArrayList<Card>[][] privateCards)
numPlayers
- numRounds
- publicCards
- privateCards
- Method Detail |
---|
public java.util.ArrayList<Card> getPublicCards(int round)
round
- an int representing the round to return the public cards for
public void setPublicCards(java.util.ArrayList<Card>[] publicCards)
publicCards
- an @ArrayList of @Cards that represents the public cards
for the handpublic java.util.ArrayList<Card> getPrivateCards(int player, int round)
player
- an int representing the seat of the player to return the cards
toround
- an int representing the round the private cards came from
public void setPrivateCards(java.util.ArrayList<Card>[][] privateCards)
privateCards
- an @ArrayList of @Cards representing the players private cardsprivate void initializeCardArrays()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getEvaluationString(int player)
player
- An integer representing the index of the player for the hand
public java.lang.String boardToString()
public java.lang.String getPrivateCardsString(int player, int round)
player
- An integer representation of the player for the indexround
- An integer representation of the round for the index
public java.lang.String getPublicCardsString(int round)
round
- An integer representation of a round for the index
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |