heurgame
Class PlayerToken

java.lang.Object
  extended byheurgame.PlayerToken

public class PlayerToken
extends java.lang.Object

Author:
David Kaplin Identifies each player to the system. Allows easier debugging and better abstraction from the origin of the players.

Constructor Summary
protected PlayerToken(PlayerProxy parent, java.lang.String origin, java.lang.String name)
          This should only be called in the PlayerProxy Class.
 
Method Summary
 java.lang.String getName()
           
 java.lang.String getOrigin()
           
 java.lang.String getWhitespaceSafeName()
          To adapt for whitespace intolerant protocols.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlayerToken

protected PlayerToken(PlayerProxy parent,
                      java.lang.String origin,
                      java.lang.String name)
This should only be called in the PlayerProxy Class. No other classes should create PlayerTokens.

Parameters:
parent - The connection to the player's input, insures you have access to a PlayerProxy for construction.
origin - Describing the source of the input, usually a network address.
name - Name of the player.
Method Detail

getName

public java.lang.String getName()
Returns:
Name given to the player by the player.

getWhitespaceSafeName

public java.lang.String getWhitespaceSafeName()
To adapt for whitespace intolerant protocols.

Returns:
Name where all whitespace is removed and replaced with underscores.

getOrigin

public java.lang.String getOrigin()
Returns:
Origin of the input from the player, usually a network address, might be something more exotic.