/** * OtherPlayers.java */ package boondock.holdem.Player; import boondock.holdem.Cards.*; /** * Class for OtherPlayers (temporary players that the GUI uses to display information about the other players in the game). * * @author Jonathan O'Keefe * @author Scott Semonian * @author Matt Brinza * @author Hamid R. Tahsildoost * * @author The Boondock Saints * @author No Limit Texas Holdem */ public class OtherPlayer { private String name, card1, card2; private int playerIndex, chipCount; private boolean inHand = false, isMe = false; /** * Allocates memory for instances of other players used by GUI for output * and temporary storage. */ public OtherPlayer() { this.name = "voidPlayer"; this.chipCount = 0; } /** * Creates class of OtherPlayers used by GUI for output * and temporary storage, given initial values. * * @param newName The name of the OtherPlayer. * @param newCount The other player's initial chip count. */ public OtherPlayer(String newName, int newCount) { this.name = newName; this.chipCount = newCount; } /** * Sets the index, aka order in turn around the table, of this OtherPlayer. * * @param index The index, or order, of this OtherPlayer. */ public void setIndex(String index) { this.playerIndex = Integer.parseInt(index); } /** * Sets the name of this OtherPlayer. * * @param newName The name of this OtherPlayer. */ public void setName(String newName) { this.name = newName; } /** * Sets the chip count of this OtherPlayer. * * @param newCount The chip count of this OtherPlayer. */ public void setChipCount(String newCount) { this.chipCount = Integer.parseInt(newCount); } /** * Sets the string name of the first card of this OtherPlayer. * * @param firstCard The string version of the first card of this OtherPlayer. */ public void setFirstCard(String firstCard) { this.card1 = firstCard; } /** * Sets the string name of the second card of this OtherPlayer. * * @param secondCard The string version of the second card of this OtherPlayer. */ public void setSecondCard(String secondCard) { this.card2 = secondCard; } /** * Sets whether this OtherPlayer is playing in the current hand or has folded. * * @param inORout The status of this OtherPlayer in. True means in the current hand, false means not in the current hand. */ public void setIsInHand(boolean inORout) { this.inHand = inORout; } /** * Sets whether this OtherPlayer is the current gui player. * * @param isMe True if this is the gui's player. */ public void setIsMyPlayer(boolean isMe) { this.isMe = isMe; } /** * Gets this OtherPlayer's name. * * @return Name of this OtherPlayer. */ public String getName() { return name; } /** * Gets this OtherPlayer's playerIndex, which is their order in turn around the table. * * @return The playerIndex of this OtherPlayer. */ public int getIndex() { return this.playerIndex; } /** * Gets this OtherPlayer's chip count. * * @return The number of chips of this OtherPlayer. */ public int getChipCount() { return chipCount; } /** * Gets this OtherPlayer's first card. * * @return A string representation of this OtherPlayer's first card. */ public String getFirstCard() { return card1; } /** * Gets this OtherPlayer's second card. * * @return A string representation of this OtherPlayer's second card. */ public String getSecondCard() { return card2; } /** * Gets whether this OtherPlayer is playing in the current hand or has folded. * * @return The status of this OtherPlayer in (true means in the current hand, false means not in the current hand). */ public boolean isInHand() { return inHand; } /** * Gets whether this OtherPlayer is the gui's owner. * * @return True if this OtherPlayer is the gui owner. */ public boolean isMyPlayer() { return isMe; } /** * Gets this OtherPlayer as a string which can be outputted to screen or sent as package. * * @return This OtherPlayer as a string which can be outputted to screen or sent as package. */ public String toString() { return getName() + "\nChip Count: " + getChipCount(); } } // end of OtherPlayer class