|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmodel.pieces.Piece
model.pieces.King
public class King
Represents the King piece
| Constructor Summary | |
|---|---|
King(java.lang.String x,
boolean z,
javax.swing.Icon r)
constructor: Constructs a new King 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 | |
|---|---|
void |
hasMoved()
transformer(mutative): Notifies that the King has moved, thus making it impossible in the future to execute a castling move. |
void |
hasMoved(boolean what)
transformer(mutative): Changes the info if the King has moved, thus making it impossible in the future to take place in a castling move. |
boolean |
isMoved()
accessor(selector): Tells us whether the King has moved or not. |
java.util.List<Move> |
moves(Cell p,
ChessBoard b)
Creates and returns a List of all the possible Moves the King can execute. |
java.lang.String |
toString()
accessor(selector): Returns a String representation of the King. |
| 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 |
|---|
public King(java.lang.String x,
boolean z,
javax.swing.Icon r)
r - Defines the icon of the King.x - Defines the name of the King.z - Defines the color of the King. White for true, black for false.| Method Detail |
|---|
public void hasMoved()
Castlingpublic void hasMoved(boolean what)
what - boolean showing wether given king has moved or not.Castlingpublic boolean isMoved()
public java.util.List<Move> moves(Cell p,
ChessBoard b)
moves in class Piecep - Is the Cell of the King which the moves we want to find.b - The ChessBoard on which the King's moves are found.
public java.lang.String toString()
toString in class Piece
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||