|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPlayer
public abstract class Player
A class representation of the Player object. This object contains the methods needed when one of the users clicks on one of the buttons within the GUI.
Field Summary | |
---|---|
static int |
LOCALPLAYER
|
static int |
NETWORKPLAYER
|
Constructor Summary | |
---|---|
Player(int num,
Rules newRules,
Driver newDriver)
Create a new instance of a Player object to represent one of the users. |
Method Summary | |
---|---|
abstract void |
acceptDraw(Player player)
When the current player accepts a draw, this method is called in the opposite player to inform them that the draw has been accepted. |
abstract void |
endInDeclineDraw(Player player)
Method is invoked if the other player declines a draw. |
abstract void |
endInDraw(Player player)
Method that is invoked when the end of game conditions have been met. |
abstract void |
endOfGame(java.lang.String message)
This method is used for when a user has clicked on the "Quit" button on the GUI. |
java.awt.Color |
getColor()
Return the color of this player |
java.lang.String |
getName()
Returns the players name |
int |
getNumber()
Returns the number for this player |
int |
getType()
Return the type of player. |
boolean |
makeMove(int start,
int end)
Make an istance of a Move that was just made and pass it to theRules by calling its validateMove method. |
abstract void |
offerDraw(Player player)
When the current player clicks the draw button, this method is called in the opposite player to inform them that a draw has been offered. |
void |
setColor(java.awt.Color newColor)
Set the color for this player. |
void |
setName(java.lang.String name)
Sets the players name |
java.lang.String |
toString()
A string representation of this object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static int LOCALPLAYER
public static int NETWORKPLAYER
Constructor Detail |
---|
public Player(int num, Rules newRules, Driver newDriver)
num
- The number of the player.newRules
- The rules used to validate moves.newDriver
- Driver which will control this.Method Detail |
---|
public int getType()
public boolean makeMove(int start, int end)
start
- The starting spot of the move. The legal
squares on the checkers boardare numbered
from 1 to 32, left to right, top to bottom.end
- The ending spot of the move.
public abstract void endOfGame(java.lang.String message)
the
- player who quitpublic abstract void offerDraw(Player player)
the
- player who offered the drawpublic abstract void acceptDraw(Player player)
public abstract void endInDeclineDraw(Player player)
public abstract void endInDraw(Player player)
endMessage
- Message indicating the end of the game.public int getNumber()
public java.lang.String getName()
public void setName(java.lang.String name)
the
- name to be setpublic java.awt.Color getColor()
public void setColor(java.awt.Color newColor)
newColor
- The new color for this player.public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |