java.lang.Object RowOfPiles
public class RowOfPiles
Class that represents a row of card piles (or, more technically, a row of the top cards).
Constructor Summary | |
---|---|
RowOfPiles()
Constructs an empty row of piles. |
Method Summary | |
---|---|
void |
addPile(Card top)
Adds a new pile at the end of the current row of piles. |
boolean |
movePile(Card fromTop,
Card toTop)
Moves a pile on top of another pile either 1 or 3 spots away. |
int |
numPiles()
Determines the number of piles in the row. |
java.lang.String |
toString()
Returns a string representation of the row. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RowOfPiles()
Method Detail |
---|
public void addPile(Card top)
top
- the card on top of the new pilepublic boolean movePile(Card fromTop, Card toTop)
fromTop
- the card on top of the pile to be movedtoTop
- the card on top of the pile to be covered
public int numPiles()
public java.lang.String toString()
toString
in class java.lang.Object