model.pieces
Class Pawn

java.lang.Object
  extended by model.pieces.Piece
      extended by model.pieces.Pawn

public class Pawn
extends Piece

Represents the Pawn piece


Constructor Summary
Pawn(java.lang.String x, boolean z, javax.swing.Icon r)
          constructor: Constructs a new Pawn piece, with color based on the parameter z(white for true, black for false) and name based on the parameter x and the Icon(parameter r).
 
Method Summary
 java.util.List<Move> moves(Cell p, ChessBoard b)
          Creates and returns a List of all the possible Moves the given Pawn can execute.
 java.lang.String toString()
          accessor(selector): Returns a String representation of the Pawn.
 
Methods inherited from class model.pieces.Piece
getColor, getIcon, getName, setIcon, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Pawn

public Pawn(java.lang.String x,
            boolean z,
            javax.swing.Icon r)
constructor: Constructs a new Pawn piece, with color based on the parameter z(white for true, black for false) and name based on the parameter x and the Icon(parameter r).
postcondition: Creates a new Pawn piece based on the input parameters, the x parameter for its name, and the z parameter for its color and r parameter for it's icon.

Parameters:
r - Defines the icon of the Pawn.
x - Defines the name of the Pawn.
z - Defines the color of the Pawn. White for true, black for false.
Method Detail

moves

public java.util.List<Move> moves(Cell p,
                                  ChessBoard b)
Creates and returns a List of all the possible Moves the given Pawn can execute.
postcondition: Returns all the possible moves of the Pawn at the given Cell at the given ChessBoard. If the Cell doesn't contain a Pawn or no Piece at all, the empty list is returned.

Specified by:
moves in class Piece
Parameters:
p - Is the Cell of the Pawn which the moves we want to find.
b - The ChessBoard on which the Pawn's moves are found.
Returns:
List of all of Pawn's moves.

toString

public java.lang.String toString()
accessor(selector): Returns a String representation of the Pawn.
postcondition: Returns a String display of the Pawn.

Overrides:
toString in class Piece
Returns:
a String symbolizing the Pawn.