bluegammon.logic
Class Player

java.lang.Object
  extended bybluegammon.logic.Player
Direct Known Subclasses:
LocalPlayer, RemotePlayer

public abstract class Player
extends java.lang.Object

Abstract class for a player. Contains generic functionality and has helper methods for sending events to any PlayerListener.

Author:
Peter Andersson

Constructor Summary
Player()
           
 
Method Summary
 void addListener(PlayerListener listener)
          Adds a listener to this player.
 int getId()
          Returns the id of this player.
 char[] getName()
          Returns the name of this player.
 void init(int id, char[] name, boolean white)
          Initializes this player.
 boolean isWhite()
          Returns the color of this player.
 void setWhite(boolean white)
          Sets the color of the player.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Player

public Player()
Method Detail

init

public void init(int id,
                 char[] name,
                 boolean white)
Initializes this player.

Parameters:
id - The id of the player.
name - The name of the player.
white - The color of the player, true for white, false for black.

setWhite

public void setWhite(boolean white)
Sets the color of the player.

Parameters:
white - True for white, false for black.

getId

public int getId()
Returns the id of this player.

Returns:
The player id.

getName

public char[] getName()
Returns the name of this player.

Returns:
The player name.

isWhite

public boolean isWhite()
Returns the color of this player.

Returns:
True for white, false for black.

addListener

public void addListener(PlayerListener listener)
Adds a listener to this player.

Parameters:
listener - The listener to add.