model.pieces
Class Bishop

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

public class Bishop
extends Piece

Represents the Bishop piece


Constructor Summary
Bishop(java.lang.String x, boolean z, javax.swing.Icon r)
          constructor: Constructs a new Bishop 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 Bishop can execute.
 java.lang.String toString()
          accessor(selector): Returns a String representation of the Bishop.
 
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

Bishop

public Bishop(java.lang.String x,
              boolean z,
              javax.swing.Icon r)
constructor: Constructs a new Bishop 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 Bishop 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 Bishop.
x - Defines the name of the Bishop.
z - Defines the color of the Bishop. 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 Bishop can execute.
postcondition: Returns all the possible moves of the Bishop at the given Cell at the given ChessBoard. If the Cell doesn't contain a Bishop or no Piece at all, the empty list is returned.

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

toString

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

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