// file: $ISIP_IFC/class/java/DemoPlayer.java // version: $Id: DemoPlayer.java 10232 2005-09-13 14:29:50Z stanley $ // // import necessary java libraries // import java.awt.*; /** * This class represents the information for a player, or client. */ public class DemoPlayer { //------------------------------------------------------------------------- // // public constants // //------------------------------------------------------------------------- //------------------------------------------------------------------------ // // protected data // //----------------------------------------------------------------------- /** * The player's name. */ protected String name_d; /** * The player's unique ID. */ protected int unique_id_d; /** * The player's ip address. */ protected String ip_address_d; /** * The player's port number. */ protected int port_number_d; //------------------------------------------------------------------------- // // public methods // //------------------------------------------------------------------------- /** * Assigns the uniqueId to the values passed * in uniqueID_a . * * @param uniqueID_a the unique ID assigned by the server to this * client. */ public DemoPlayer(int uniqueID_a) { unique_id_d = uniqueID_a; } //------------------------------------------------------------------------- // // class-specific public methods: // set methods // //------------------------------------------------------------------------- /** * Set the player name. * * @param name_a a player's name. * * @return a boolean value indicating status. */ public boolean setName(String name_a) { name_d = name_a; return true; } /** * Set the player unique's id. * * @param id_a a player's unique's id. * * @return a boolean value indicating status. */ public boolean setID(int id_a) { unique_id_d = id_a; return true; } /** * Set the player's ip address. * * @param ip_address_a a player's ip address. * * @return a boolean value indicating status. */ public boolean setIPAddress(String ip_address_a) { ip_address_d = ip_address_a; return true; } /** * Set the player port number. * * @param port_a a player's port number. * * @return a boolean value indicating status. */ public boolean setPortNumber(int port_a) { port_number_d = port_a; return true; } //------------------------------------------------------------------------- // // class-specific public methods: // get methods // //------------------------------------------------------------------------- /** * Get the player's name. * * @return a string to represent the player's name. */ public String getName() { return name_d; } /** * Get the player's unique's id. * * @return an int for the player's unique's id. */ public int getID() { return unique_id_d; } /** * Get the player's ip address. * * @return a string to represent the player's ip address. */ public String getIPAddress() { return ip_address_d; } /** * Get the player's port number. * * @return an int for the player's port number. */ public int getPortNumber() { return port_number_d; } }