org.gjt.universe
Class PlayerList

java.lang.Object
  |
  +--org.gjt.universe.PlayerList

public final class PlayerList
extends java.lang.Object

The this class handles look-up of specific players. by their unique ID. All players currently in the game will be present in the list, with eliminated players being removed as needed. Also note that rather than being eliminated a a player may simply be assigned a new civilization, depending on game options and other factors. Furthermore, a human player may resign from the game in which case a new player (computer or human) will be added to the game in their place and given control of the resigning player's civilization.

See Also:
PlayerBase, CivList

Field Summary
private static DBTable DB
           
 
Constructor Summary
private PlayerList()
          This is declared private as no actual instance of this class is ever created (all methods are static).
 
Method Summary
static void add(PlayerBase obj)
          This method adds the given player to the master list of those currently in the game.
static java.util.Enumeration elements()
          This method returns an enumeration of all players currently in the game.
static PlayerBase get(PlayerID id)
          This method returns the player with the given ID.
(package private) static void readObject(java.io.ObjectInputStream in)
          This method takes the list of players stored in the given stream (previously written using writeObject) as the current list of those available in the game.
static PlayerBase remove(PlayerID id)
          This method removes the given player from the master list of those currently in the game.
static int size()
          This method returns the number of players in the game.
(package private) static void writeObject(java.io.ObjectOutputStream out)
          This method adds the current list of players to the given stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DB

private static DBTable DB
Constructor Detail

PlayerList

private PlayerList()
This is declared private as no actual instance of this class is ever created (all methods are static).

Method Detail

add

public static void add(PlayerBase obj)
This method adds the given player to the master list of those currently in the game. This method is called automatically as part of the constructor for the PlayerBase class and thus need not be called directly by other objects.

Parameters:
obj - The player to be added.

remove

public static PlayerBase remove(PlayerID id)
This method removes the given player from the master list of those currently in the game. This method is called automatically by the PlayerBase class when needed and thus need not be called directly by other objects.


get

public static PlayerBase get(PlayerID id)
This method returns the player with the given ID. If there is no such player, this method will return an undefined player object.

Parameters:
id - The unique ID of the desired player object.
See Also:
class.

size

public static int size()
This method returns the number of players in the game.


writeObject

static void writeObject(java.io.ObjectOutputStream out)
                 throws java.io.IOException
This method adds the current list of players to the given stream. This method is typically called by code involved in saving a game.

java.io.IOException
See Also:
readObject

readObject

static void readObject(java.io.ObjectInputStream in)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
This method takes the list of players stored in the given stream (previously written using writeObject) as the current list of those available in the game. This method is typically called by code involved in restoring a saved game.

java.io.IOException
java.lang.ClassNotFoundException
See Also:
writeObject

elements

public static java.util.Enumeration elements()
This method returns an enumeration of all players currently in the game. No particular order is guaranteed.



Copyright © 2001 Universe Dev Team All Rights Reserved.