|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Observable | +--Tableau
Tableau represents a group of Card objects. The size of the group is typically 12, but may be 15 (if there is no set in the 12) or a smaller multiple of 3 (if there are no cards remaining in the deck. The order of the cards in the tableau is not significant. Cards are added or removed only in a quantity of 3. Tableau extends Observable. Observers are notified with a Boolean false argument if the change is merely a highlighted value, and a true argument if cards have been added or removed.
Constructor Summary | |
Tableau()
Constructor for objects of class Tableau |
Method Summary | |
void |
addCard(Card c)
Adds a card to the group. |
void |
clear()
Removes all cards from the tableau. |
void |
clearHighlight()
Sets all cards in the tableau to not-highlighted status. |
boolean |
containsSet()
Returns true if and only if there are three cards in the tableau that form a valid set. |
GroupOfThree |
findSet()
Returns a GroupOfThree containing cards from the tableau that form a set. |
Card |
getCard(int whichCard)
Returns a specified card from the tableau. |
GroupOfThree |
getHighlightedGroup()
Gets the cards highlighted on the screen and returns them. |
boolean |
isLit(Card c)
Returns true if and only if c is in the tableau and is highlighted. |
int |
numberLitCards()
Returns the number of cards in the tableau that are currently highlighted. |
int |
numberOfCards()
Returns the number of cards currently in the tableau. |
void |
refill(Deck d)
Adds three cards to the tableau. |
void |
removeGroup(GroupOfThree g)
Removes the cards in the group from the tableau if present. |
void |
toggleCard(Card c)
Attempts to toggle the highlighted status of card c. |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Tableau()
Method Detail |
public void addCard(Card c)
c
- The card to be addedpublic void clear()
public void clearHighlight()
public boolean containsSet()
public GroupOfThree findSet()
public Card getCard(int whichCard)
whichCard
- Either 0, 1, 2, ... or 12 or ...15.
public GroupOfThree getHighlightedGroup()
public boolean isLit(Card c)
public int numberLitCards()
public int numberOfCards()
public void refill(Deck d)
public void removeGroup(GroupOfThree g)
g
- The group of cards to be removed.public void toggleCard(Card c)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |