|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCardPile
public class CardPile
| Constructor Summary | |
|---|---|
CardPile()
Constructor |
|
| Method Summary | |
|---|---|
boolean |
addCard(Card card)
Adds a card to the pile, if card is addable |
void |
clear()
Clears the pile |
boolean |
dealCard(Card card)
Deals a card to the pile. |
boolean |
forceAddCard(Card card)
Adds a card to pile (no conditions) |
Card |
getCard()
Gets top card from pile, unless pile is empty |
int |
getMaxSize()
Returns maximum size of pile |
java.lang.String |
getPileID()
Returns the pile's unique ID, e.g., "t2" |
int |
getSize()
Returns size of pile |
java.lang.String |
getSuit()
Returns suit of pile |
IGuiCard |
getVisibleCard(int index)
Returns the index(th) visible card |
boolean |
isAddable(Card card)
Checks if card can be added to pile By default, as long as pile is not empty, a card can be removed |
boolean |
isEmpty()
Checks if pile is full or not |
boolean |
isFull()
Checks if pile is empty or not |
boolean |
isRemovable()
Checks if card can be removed from pile By default, as long as pile is not empty, a card can be removed |
boolean |
isSameSuit(Card card)
Checks if pile is of the same suit as card |
static void |
main(java.lang.String[] args)
Main method, checks whether there are bugs in class |
int |
maxVisibleCount()
Returns the max number of cards in the pile. |
Card |
removeCard()
Adds a card to the pile, if card is addable |
void |
setID(java.lang.String ID)
Sets the ID for the pile model to the String ID |
void |
setMaxSize(int maxSize)
Sets maxSize of pile to maxSize |
void |
setSuit(java.lang.String suit)
Sets mySuit of pile to suit |
void |
setView(IPileView view)
Sets the view of the pile |
void |
update()
Tells the view for this pile to update itself - this is overridden in both the TableauPiles and CellPiles classes. |
int |
visibleCardCount()
Returns the number of cards in the pile. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CardPile()
| Method Detail |
|---|
public void setSuit(java.lang.String suit)
suit - public void setMaxSize(int maxSize)
maxSize - public void setID(java.lang.String ID)
ID - the ID created for this pilepublic Card getCard()
getCard in interface ICardPilepublic int getSize()
public java.lang.String getSuit()
public int getMaxSize()
public boolean addCard(Card card)
addCard in interface ICardPilecard - is the Card Object being added
public Card removeCard()
removeCard in interface ICardPilepublic boolean forceAddCard(Card card)
card - is the Card Object being added
public boolean dealCard(Card card)
card - the card to deal to the pile
public boolean isAddable(Card card)
isAddable in interface ICardPilecard - is the Card object being added
public boolean isRemovable()
isRemovable in interface ICardPilecard - is the Card object being added
public boolean isEmpty()
isEmpty in interface ICardPilepublic boolean isFull()
isFull in interface ICardPilepublic boolean isSameSuit(Card card)
public void clear()
clear in interface ICardPilepublic static void main(java.lang.String[] args)
public void setView(IPileView view)
setView in interface IGuiPileModelview - is the view "observing" this modelpublic int visibleCardCount()
visibleCardCount in interface IGuiPileModelpublic int maxVisibleCount()
maxVisibleCount in interface IGuiPileModelpublic java.lang.String getPileID()
getPileID in interface IGuiPileModelpublic IGuiCard getVisibleCard(int index)
getVisibleCard in interface IGuiPileModelindex - specifies which visible card obtained from model
public void update()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||