|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectPiece
public abstract class Piece
This class contains information and methods associated with the piece for a checker board public
| Field Summary | |
|---|---|
protected int |
checkerNumber
|
protected java.awt.Color |
color
|
protected java.awt.Point |
coord
|
protected boolean |
isNull
|
protected Player |
player
|
protected java.awt.Point |
pos
|
protected int |
width
|
| Constructor Summary | |
|---|---|
Piece()
|
|
| Method Summary | |
|---|---|
abstract void |
drawChecker(java.awt.Graphics g)
This method is a forward declaration for the draw methods in King and Pawn. |
void |
executeMove(int col,
int row,
Board b)
Since the move has been verified as valid this method only concerns itself with moving the pieces. |
int |
getCheckerNumber()
This method gets the number of the current piece public |
int |
getCol()
This method gets protected information from the Piece class. |
java.awt.Color |
getColor()
This method gets protected information from the checker class. |
int |
getRow()
This method gets protected information from the Piece class. |
int |
getWidth()
This method gets protected information from the Piece class. |
int |
getXpos()
This method gets protected information from the Piece class. |
int |
getYpos()
This method gets protected information from the Piece class. |
void |
hasBeenJumped(Square containedBy)
This method removes a jumped piece from the board. |
abstract boolean |
isKing()
This method is a forward declaration for a functor that returns whether or not the piece is a King. |
abstract boolean |
isMoveValid(boolean isBlackSquare,
boolean isNotEmpty,
int c,
int r,
Board b)
This method check to see if a checker move is valid. |
boolean |
isNull()
This method checks to see if the current piece is "null". |
void |
setCheckerNumber(int chNo)
This method sets the number of the current piece public |
void |
setCol(int c)
This method sets col. |
void |
setColor(java.awt.Color c)
This method sets color. |
void |
setRow(int r)
This method sets row. |
void |
setWidth(int w)
This method sets width of the piece. |
void |
setXpos(int x)
This method sets x position in pixels. |
void |
setYpos(int y)
This method sets y position in pixels. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.awt.Point pos
protected java.awt.Point coord
protected int width
protected java.awt.Color color
protected Player player
protected int checkerNumber
protected boolean isNull
| Constructor Detail |
|---|
public Piece()
| Method Detail |
|---|
public int getXpos()
public void setXpos(int x)
x - the x position of the piece in pixelspublic int getYpos()
public void setYpos(int y)
y - the y position of the piece in pixelspublic java.awt.Color getColor()
public void setColor(java.awt.Color c)
c - sets the new color for the piecepublic int getCol()
public void setCol(int c)
c - the x coordinate of the Piecepublic int getRow()
public void setRow(int r)
r - sets the y coordinate of the piecepublic int getWidth()
public void setWidth(int w)
w - the width of the piece
public abstract boolean isMoveValid(boolean isBlackSquare,
boolean isNotEmpty,
int c,
int r,
Board b)
isBlackSquare - true if it is occupiable squareisNotEmpty - true if the square has a piecec - destination of x coordinater - destination of y coordinateb - a reference to Board
public void hasBeenJumped(Square containedBy)
containedBy - the square that contains this piecepublic int getCheckerNumber()
public void setCheckerNumber(int chNo)
chNo - Sets the number of the current piecepublic boolean isNull()
public abstract void drawChecker(java.awt.Graphics g)
g - the passed Graphics objectpublic abstract boolean isKing()
public void executeMove(int col,
int row,
Board b)
col - x coordinate of its destinationrow - y coordinate of its destinationb - a reference to the board in order to refer to other pieces
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||