|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectprogram4.Hand
public class Hand
Title: The Hand Class
Description: Defines the properties and behaviors of a GoFish Hand.
Copyright: Copyright (c) 2010
Field Summary | |
---|---|
private java.util.LinkedList<GoFishCard> |
hand
LinkList of GoFish Cards |
Constructor Summary | |
---|---|
Hand()
Default constructor |
Method Summary | |
---|---|
int |
countRank(int rank)
Counts the number of cards of a particular rank in the hand |
int |
evaluate()
Returns 1 if a book (all 4 cards of a particular suit) is in the hand and removes the book from the hand |
java.util.LinkedList<GoFishCard> |
findRank(int rank)
Finds and returns all cards of the specified rank |
GoFishCard |
getCardAt(int index)
Returns the card at the specified position in this list. |
java.util.LinkedList<GoFishCard> |
getCards(int rank)
Returns a list of cards of a specified rank |
int |
getCount()
Returns the number of cards in the hand |
java.util.LinkedList<GoFishCard> |
getHand()
Returns the hand as LinkedList of GoFish cards |
boolean |
hasRank(int rank)
Returns true if this rank is the hand |
void |
insertByRank(GoFishCard card)
Adds a Card to the hand, the hand is sorted by rank |
void |
insertHand(java.util.Collection<? extends GoFishCard> otherHand)
Adds a LinkList of Cards to the hand, the hand is sorted by rank |
boolean |
isEmpty()
Determines if the hand is empty |
java.lang.String |
toString()
Returns a string representation of the hand |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private java.util.LinkedList<GoFishCard> hand
Constructor Detail |
---|
public Hand()
Method Detail |
---|
public int getCount()
public java.util.LinkedList<GoFishCard> getHand()
public boolean hasRank(int rank)
rank
- - the rank to search for
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.LinkedList<GoFishCard> findRank(int rank)
rank
- - the rank to search for
public void insertByRank(GoFishCard card)
card
- - a GoFish Cardpublic void insertHand(java.util.Collection<? extends GoFishCard> otherHand)
otherHand
- LinkedList of GoFish Cardspublic boolean isEmpty()
public int evaluate()
public int countRank(int rank)
rank
- - the rank to count
public GoFishCard getCardAt(int index)
index
- the index of the list
public java.util.LinkedList<GoFishCard> getCards(int rank)
rank
- - the rank to search for
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |