heineman.klondike
Class MoveColumnMove

java.lang.Object
  |
  +--ks.common.model.Move
        |
        +--heineman.klondike.MoveColumnMove

public class MoveColumnMove
extends ks.common.model.Move

Represents the move of a column between Piles.

There are two scenarios when constructing a moveColumnMove object. (1) The move has not yet taken place (but is being proposed); in this case, there is no Column being moved, only a number of cards. (2) The move has already occured, so the Column is available, and the number of cards can easily be calculated.

See Also:
Serialized Form

Field Summary
protected  Column columnBeingDragged
          Column being moved.
protected  BuildablePile from
          From BuildablePile.
protected  int numCards
          Number of cards to move.
protected  BuildablePile to
          To BuildablePile.
 
Constructor Summary
MoveColumnMove(BuildablePile fromPile, BuildablePile toPile, Column columnBeingDragged, int numCards)
          MoveCardToFoundationmove constructor.
 
Method Summary
 boolean doMove(Solitaire theGame)
          Each move should knows how to execute itself.
 boolean undo(ks.common.games.Solitaire game)
          undo of a MoveColumnMove.
 boolean valid(Solitaire game)
          Action for Klondike: Move a Column from one BuildablePile to another
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

from

protected BuildablePile from
From BuildablePile.


to

protected BuildablePile to
To BuildablePile.


numCards

protected int numCards
Number of cards to move.


columnBeingDragged

protected Column columnBeingDragged
Column being moved.

Constructor Detail

MoveColumnMove

public MoveColumnMove(BuildablePile fromPile,
                      BuildablePile toPile,
                      Column columnBeingDragged,
                      int numCards)
MoveCardToFoundationmove constructor.

If the move has already been made, then columnBeingDragged is non-null, and numCards == columnBeingDragged.count() If the move has not been made, then only the number of cards to be moved is known, and columnBeingDragged is null.

Method Detail

doMove

public boolean doMove(Solitaire theGame)
Each move should knows how to execute itself.

Returns:
boolean

undo

public boolean undo(ks.common.games.Solitaire game)
undo of a MoveColumnMove.


valid

public boolean valid(Solitaire game)
Action for Klondike: Move a Column from one BuildablePile to another

Parameters:
game - ks.game.Solitaire