model.pieces
Class Queen
java.lang.Object
model.pieces.Piece
model.pieces.Queen
public class Queen
- extends Piece
Represents the Queen piece
|
Constructor Summary |
Queen(java.lang.String x,
boolean z,
javax.swing.Icon r)
constructor: Constructs a new Queen 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 Queen can execute. |
java.lang.String |
toString()
accessor(selector): Returns a String representation of the Queen. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Queen
public Queen(java.lang.String x,
boolean z,
javax.swing.Icon r)
- constructor: Constructs a new Queen 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 Queen 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 Queen.x - Defines the name of the Queen.z - Defines the color of the Queen. White for true, black for false.
moves
public java.util.List<Move> moves(Cell p,
ChessBoard b)
- Creates and returns a List of all the possible Moves the Queen can execute.
The Queen can move in all directions with no restrictions.
postcondition: Returns all the possible moves of the Queen at the given
Cell at the given ChessBoard. If the Cell doesn't contain a Queen or no Piece
at all, the empty list is returned.
- Specified by:
moves in class Piece
- Parameters:
p - Is the Cell of the Queen which the moves we want to find.b - The ChessBoard on which the Queen's moves are found.
- Returns:
- List of all of Queen's moves.
toString
public java.lang.String toString()
- accessor(selector): Returns a String representation of the Queen.
postcondition: Returns a String display of the Queen.
- Overrides:
toString in class Piece
- Returns:
- a String symbolizing the Queen.