public class Foundation extends CardStack
| Constructor and Description |
|---|
Foundation() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canPlayFrom()
Throws IllegalPlayException "That card stack cannot be played from."
|
boolean |
playTo(Card card)
Given a card to be played to the top of this card stack, either make the legal play and return true, or throw an appropriate Exception.
|
addCard, getTopCard, isEmpty, playTo, removeTopCard, size, toArray, toStringpublic boolean canPlayFrom()
throws IllegalPlayException
canPlayFrom in class CardStackIllegalPlayException - thrown "That card stack cannot be played from."public boolean playTo(Card card) throws java.lang.NullPointerException, IllegalPlayException
playTo in class CardStackcard - card to be played onto this card stackjava.lang.NullPointerException - thrown if given Card parameter is nullIllegalPlayException - thrown if "The first foundation card must be an Ace." or "Plays to a foundation must match suit." / "Plays to a foundation must have the next increasing rank." in that order.