|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectsmithers.cards.AbstractBuildingRule
public abstract class AbstractBuildingRule
Simplifies the definition of a BuildingRule be redefining in terms
of a different collection of methods.
| Field Summary | |
|---|---|
protected boolean |
canAddMultiple
Set to true if multiple cards can be added at once. |
| Constructor Summary | |
|---|---|
AbstractBuildingRule()
|
|
| Method Summary | |
|---|---|
boolean |
canAddCard(CardStack stack,
Card add)
Determines whether the specified card can be added to the top of the stack. |
int |
canAddCards(CardStack stack,
CardStack add)
Determines whether cards can be moved from one stack to another. |
abstract boolean |
goesInSpace(Card c)
Determines whether the specified card can be placed in an empty space. |
abstract boolean |
goesOn(Card c1,
Card c2)
Determines whether card c2 can be placed on top of card c1. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean canAddMultiple
true if multiple cards can be added at once.
| Constructor Detail |
|---|
public AbstractBuildingRule()
| Method Detail |
|---|
public abstract boolean goesOn(Card c1,
Card c2)
c2 can be placed on top of card c1.
c1 - the card to move ontoc2 - the card to be moved
true iff the card can be movedpublic abstract boolean goesInSpace(Card c)
c - the card to be moved
true iff the card can be moved into a space
public boolean canAddCard(CardStack stack,
Card add)
canAddCard in interface BuildingRulestack - the stack to add the card toadd - the card to add
true iff the card can be added
public int canAddCards(CardStack stack,
CardStack add)
0 if no cards can be moved. Note this method makes no
checks according to whether the required cards can all legally be moved
from the source stack, as this stack may be operating under different
rules.
canAddCards in interface BuildingRulestack - the stack to move cards toadd - the stack to move cards from
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||