model.moves
Class CapturePromotion

java.lang.Object
  extended by model.moves.Move
      extended by model.moves.Promotion
          extended by model.moves.CapturePromotion

public class CapturePromotion
extends Promotion

Represents a promotion that also captures an opponent's piece.


Constructor Summary
CapturePromotion(Cell sour, Cell dest, Piece capt)
          constructor: Creates a new CapturePromotion move that needs a destination and a source cell.
 
Method Summary
 boolean move(ChessBoard x)
          transformer(mutative): Applies a Capture Promotion move on the given ChessBoard.
 void prev(ChessBoard x)
          transformer(mutative): Takes the chess board a move back.
 void setPromotedTo(Piece what)
          transformer(mutative): Sets the piece to be promoted to the one passed as argument.
 java.lang.String toString()
          accessor(selector): Creates a String representation of the CapturePromotion move.
 
Methods inherited from class model.moves.Move
equals, getFrom, getTo
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CapturePromotion

public CapturePromotion(Cell sour,
                        Cell dest,
                        Piece capt)
constructor: Creates a new CapturePromotion move that needs a destination and a source cell.
postcondition: Creates a new CapturePromotion move, based on a source and destination cell.

Parameters:
sour - source Cell
dest - destination Cell
Method Detail

setPromotedTo

public void setPromotedTo(Piece what)
transformer(mutative): Sets the piece to be promoted to the one passed as argument.
postcondition: Sets the newly promoted piece to the one passed as argument.

Overrides:
setPromotedTo in class Promotion
Parameters:
what - The piece to be promoted to.

move

public boolean move(ChessBoard x)
transformer(mutative): Applies a Capture Promotion move on the given ChessBoard.
postcondition: A capture promotion move is applied on the ChessBoard.

Overrides:
move in class Promotion
Parameters:
x - Is the ChessBoard the changes will be applied.
Returns:
true if the move is successfully, false otherwise.

prev

public void prev(ChessBoard x)
transformer(mutative): Takes the chess board a move back.
postcondition: Does the exactly reverse move of the one given.

Overrides:
prev in class Promotion
Parameters:
x - is the ChessBoard that the changes will be applied.

toString

public java.lang.String toString()
accessor(selector): Creates a String representation of the CapturePromotion move.
postcondition: Creates a String display of CapturePromotion.

Overrides:
toString in class Promotion
Returns:
A string showing CapturePromotion.