|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprogram4.Player
public class Player
Title: The Player Class
Description: Defines the properties and behaviors of a GoFish Player.
Copyright: Copyright (c) 2010
Field Summary | |
---|---|
private Hand |
hand
|
private java.lang.String |
name
|
private int |
points
|
Constructor Summary | |
---|---|
Player(java.lang.String n)
Parameterized constructor |
Method Summary | |
---|---|
void |
addCard(GoFishCard card)
Adds a card to the hand |
void |
addCards(java.util.LinkedList<GoFishCard> otherHand)
Adds a LinkList of Cards to the hand |
java.util.LinkedList<GoFishCard> |
getCard(int rank)
Returns the cards of a specified rank as a Linkedlist |
GoFishCard |
getCardAt(int index)
returns the card at a specified index in the hand |
java.util.LinkedList<GoFishCard> |
getCards(int rank)
Returns all of the cards of the specified rank as a LinkedList |
java.lang.String |
getName()
Returns the player's name |
int |
getPoints()
Returns the number of books the player has |
int |
getTotalCards()
Returns the number of cards the player has |
boolean |
hasRank(int rank)
Returns true> if the player has a specified rank |
void |
setHand(Hand hand)
Sets the hand |
void |
setName(java.lang.String name)
Sets the name |
java.lang.String |
showHand()
Returns the string representation of the hand |
java.lang.String |
toString()
Returns the string representation of the player |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.lang.String name
private Hand hand
private int points
Constructor Detail |
---|
public Player(java.lang.String n)
n
- - the name of the playerMethod Detail |
---|
public java.lang.String getName()
public void setName(java.lang.String name)
name
- - the new value for namepublic java.util.LinkedList<GoFishCard> getCards(int rank)
rank
- - the rank to search for
public void setHand(Hand hand)
hand
- public int getPoints()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String showHand()
public boolean hasRank(int rank)
rank
- - the rank to search for
public void addCard(GoFishCard card)
card
- - the card to addpublic void addCards(java.util.LinkedList<GoFishCard> otherHand)
otherHand
- - the LinkedList of cardspublic GoFishCard getCardAt(int index)
index
- - the position of the card
public int getTotalCards()
public java.util.LinkedList<GoFishCard> getCard(int rank)
rank
- - the rank to search for
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |