|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPlayer
public class Player
This Player class represents all the client side game functionalites or player side game functionalities of this 304 cards game. This player class is the oparational class int he client side to deal with interface class and client class. Basically all the player side game functionalites are handled by this Player class.
Field Summary | |
---|---|
private int |
bestBet
|
private int |
bestBetBy
|
private boolean |
betFinished
|
(package private) Cards304Client |
client
|
private int |
gameId
|
(package private) Interface |
gui
|
private java.lang.Boolean[] |
hand
|
private java.util.ArrayList<Card> |
handCards
|
private int |
myBet
|
private int |
playerId
|
private int[] |
playerPoints
|
private boolean |
selectTrump
|
private java.lang.Boolean[] |
table
|
private Card[] |
tableCards
|
private java.lang.String[] |
team
|
private Card |
trump
|
private boolean |
trumpOpen
|
private boolean |
trumpTrun
|
private int[] |
wins
|
Constructor Summary | |
---|---|
Player(Cards304Client client)
Constucter method of this class. |
Method Summary | |
---|---|
void |
addme2team(java.lang.String myName)
This method is to a player's name to a team. |
private int |
enemyOf(int player)
This method is to find an openent of a player. |
void |
exitGame()
This method will be triggerd from the server when someone closes his/her game window. |
protected void |
finalize()
This method finalizes the game. |
int |
getGameId()
This method is to get the game id from this class. |
int |
getPlayerId()
This method is to get the player id. |
void |
handCardSelected(int no)
This method is triggerd when any of those hand card are selected. |
void |
illbet()
This method is to accept the bet from the player. |
private boolean |
isNumeric(java.lang.String number)
This method is to check whether a string value can be converted to numeric or not. |
boolean |
isTrumpOpen()
This method checks and return whether the trump is open or not. |
void |
myTurn()
This method enables the user interface to the player to select a card when the player's turn comes. |
void |
newPlay(int player0,
int player1,
int player2,
int player3,
int winner)
This method is called when a play finishes. |
int |
noOfCards()
This method is to count the no of cards in the hand and returns by checking the hand boolean array. |
private int |
partnerOf(int player)
This method is to find the partner of a player. |
void |
printCards()
This method prints the name of cards in the hand. |
void |
resetTable()
This method is to reset the tableCards array. |
void |
scoreBoardCheck()
This method checks the score and updates teh scoreboard. |
void |
selectedConfirmed(int playerId,
java.lang.String card)
this method is to confirm player's selection. |
void |
servetherest()
This method is to server the final four cards to hand. |
void |
setBestBet(int player,
int bestbet)
This method is to set the best bet. |
void |
setGameId(int gameId)
This method sets the game id to this class object. |
void |
setHandCards(java.util.ArrayList<Card> cards)
setHandcards method is to set the cards to handCards arraylist and serves first four cards to players, in order to enable them to choose a trump. |
void |
setHandCards(java.lang.String cards)
This method is to set the cards to handCards arralylist from a single String separated my coma. |
void |
setPlayerId(int playerId)
This method is to set player id to this player class object. |
void |
setplayername(int playerId,
java.lang.String playerName)
This method sets a player's name to team string array in the right player position. |
void |
setTrumpTurn(boolean turn)
This method is to set the trump turn. |
Card |
trump()
This method is to ger the trump card. |
void |
trumpClicked()
This methed is triggerd when user clicks the tump button in the table. |
void |
trumpConfirmed()
This method is called when server confirms the trump. |
void |
trumpUsed()
This method is to check whether the trump is used or not. |
void |
updatePoints(int playerPoint0,
int playerPoint1,
int playerPoint2,
int playerPoint3)
This method is to update the points. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Cards304Client client
Interface gui
private int gameId
private int playerId
private int[] playerPoints
private int[] wins
private java.util.ArrayList<Card> handCards
private Card[] tableCards
private int myBet
private Card trump
private int bestBet
private int bestBetBy
private boolean betFinished
private boolean selectTrump
private boolean trumpOpen
private boolean trumpTrun
private java.lang.String[] team
private java.lang.Boolean[] hand
private java.lang.Boolean[] table
Constructor Detail |
---|
public Player(Cards304Client client)
client
- Cards304Client class object.Method Detail |
---|
public void addme2team(java.lang.String myName)
public void setplayername(int playerId, java.lang.String playerName)
playerId
- int player's idplayerName
- String player's name.public void setHandCards(java.util.ArrayList<Card> cards)
cards
- ArrayListpublic void setHandCards(java.lang.String cards)
cards
- String contains name of every card separated by coma.public void setBestBet(int player, int bestbet)
player
- int gets which player's bet is best.bestbet
- int the best bet.public int noOfCards()
public void trumpUsed()
public void trumpClicked()
public void handCardSelected(int no)
no
- int the array index no of hand card buttons. it'll be between 0-7.public void selectedConfirmed(int playerId, java.lang.String card)
playerId
- int index number of a player.card
- String name of the card the user selected.public void trumpConfirmed()
public void myTurn()
private int partnerOf(int player)
player
- int player id.
public void newPlay(int player0, int player1, int player2, int player3, int winner)
player0
- int first player's index number.player1
- int second player's index number.player2
- int third player's index number.player3
- int fourth player's index number.winner
- int one of the winning team member's player index number.public void scoreBoardCheck()
private int enemyOf(int player)
player
- int player id.
public boolean isTrumpOpen()
public Card trump()
public void resetTable()
public void printCards()
public void setPlayerId(int playerId)
playerId
- int player id.public int getPlayerId()
public void setTrumpTurn(boolean turn)
public void setGameId(int gameId)
gameId
- int game id.public int getGameId()
public void illbet()
public void servetherest()
public void updatePoints(int playerPoint0, int playerPoint1, int playerPoint2, int playerPoint3)
public void exitGame()
private boolean isNumeric(java.lang.String number)
number
- String value to be checked.protected void finalize()
finalize
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |