org.gjt.universe
Class CivList

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

public final class CivList
extends java.lang.Object

The this class handles look-up of specific civilizations by their unique ID. Currently civilizations are never removed from this list even when thie civilization is eliminated from game play. This is done in order to facilitate historical information display. This may change in the future.


Field Summary
private static DBTable DB
           
 
Constructor Summary
private CivList()
          This is declared private as no actual instance of this class is ever created (all methods are static).
 
Method Summary
static void add(Civ obj)
          This method adds the given civilization to the master list of those currently in the game.
static java.util.Enumeration elements()
          This method returns an enumeration of all civilizations currently in the game.
static Civ get(CivID id)
          This method returns the civilization with the given ID.
(package private) static void readObject(java.io.ObjectInputStream in)
          This method takes the list of civilizations stored in the given stream (previously written using writeObject) as the current list of those available in the game.
static Civ remove(CivID id)
          This method removes the given civilization from the master list of those currently in the game.
static int size()
          This method returns the number of civilizations in the game.
(package private) static void writeObject(java.io.ObjectOutputStream out)
          This method adds the current list of civilizations 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

CivList

private CivList()
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(Civ obj)
This method adds the given civilization to the master list of those currently in the game. This method is called automatically as part of the constructor for the Civ class and thus need not be called directly by other objects.

Parameters:
obj - The civilization to be added.

remove

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


get

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

Parameters:
id - The unique ID of the desired civilization object.
See Also:
CivUndefined

size

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


writeObject

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

java.io.IOException
See Also:
readObject( java.io.ObjectInputStream in )

readObject

static void readObject(java.io.ObjectInputStream in)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
This method takes the list of civilizations 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( java.io.ObjectOutputStream out )

elements

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



Copyright © 2001 Universe Dev Team All Rights Reserved.