rails.game
Class CompanyManager

java.lang.Object
  extended by rails.game.CompanyManager
All Implemented Interfaces:
CompanyManagerI, ConfigurableComponentI

public class CompanyManager
extends java.lang.Object
implements CompanyManagerI, ConfigurableComponentI


Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> aliases
          A map to enable translating aliases to names
protected  GameManagerI gameManager
           
protected static org.apache.log4j.Logger log
           
 
Fields inherited from interface rails.game.CompanyManagerI
COMPONENT_NAME
 
Constructor Summary
CompanyManager()
          No-args constructor.
 
Method Summary
 java.lang.String checkAlias(java.lang.String alias)
           
 java.lang.String checkAliasInCertId(java.lang.String certId)
           
 void closeAllPrivates()
           
 void configureFromXML(Tag tag)
          Instructs the component to configure itself from the provided XML element.
 void finishConfiguration(GameManagerI gameManager)
          This method is intended to be called for each configurable component, to perforn any initialisation activities that require any other components to be initialised first.
 java.util.List<PrivateCompanyI> getAllPrivateCompanies()
          Gives a list of all the registered Private Companies.
 java.util.List<PublicCompanyI> getAllPublicCompanies()
          Gives a list of all the registered Private Companies.
 CompanyI getCompany(java.lang.String type, java.lang.String name)
          Find a company by type and name
 java.util.List<CompanyTypeI> getCompanyTypes()
           
 PrivateCompanyI getPrivateCompany(java.lang.String name)
          Returns the Private Company identified by the supplied name.
 java.util.List<PrivateCompanyI> getPrivatesOwnedByPlayers()
           
 PublicCompanyI getPublicCompany(java.lang.String name)
          Returns the Public Company identified by the supplied name.
 StartPacket getStartPacket(int index)
           
 StartPacket getStartPacket(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

aliases

protected java.util.Map<java.lang.String,java.lang.String> aliases
A map to enable translating aliases to names


log

protected static org.apache.log4j.Logger log

gameManager

protected GameManagerI gameManager
Constructor Detail

CompanyManager

public CompanyManager()
No-args constructor.

Method Detail

configureFromXML

public void configureFromXML(Tag tag)
                      throws ConfigurationException
Description copied from interface: ConfigurableComponentI
Instructs the component to configure itself from the provided XML element.

Specified by:
configureFromXML in interface ConfigurableComponentI
Throws:
ConfigurationException
See Also:
rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element)

finishConfiguration

public void finishConfiguration(GameManagerI gameManager)
                         throws ConfigurationException
Description copied from interface: ConfigurableComponentI
This method is intended to be called for each configurable component, to perforn any initialisation activities that require any other components to be initialised first. This includes creating any required relationships to other configured components and objects.

This method should be called where necessary after all XML file parsing has completed, so that all objects that need to be related to do exist.

Specified by:
finishConfiguration in interface ConfigurableComponentI
Parameters:
gameManager - The 'parent' configurable component is passed to allow the 'child' to access any other object without the need to resort to static calls where possible.
Throws:
ConfigurationException

checkAlias

public java.lang.String checkAlias(java.lang.String alias)
Specified by:
checkAlias in interface CompanyManagerI

checkAliasInCertId

public java.lang.String checkAliasInCertId(java.lang.String certId)
Specified by:
checkAliasInCertId in interface CompanyManagerI

getPrivateCompany

public PrivateCompanyI getPrivateCompany(java.lang.String name)
Description copied from interface: CompanyManagerI
Returns the Private Company identified by the supplied name.

Specified by:
getPrivateCompany in interface CompanyManagerI
Parameters:
name - the name of the company sought
Returns:
the Private Company with the supplied name
See Also:
rails.game.CompanyManagerI#getCompany(java.lang.String)

getPublicCompany

public PublicCompanyI getPublicCompany(java.lang.String name)
Description copied from interface: CompanyManagerI
Returns the Public Company identified by the supplied name.

Specified by:
getPublicCompany in interface CompanyManagerI
Parameters:
name - the name of the company sought
Returns:
the Public Company with the supplied name

getAllPrivateCompanies

public java.util.List<PrivateCompanyI> getAllPrivateCompanies()
Description copied from interface: CompanyManagerI
Gives a list of all the registered Private Companies.

Specified by:
getAllPrivateCompanies in interface CompanyManagerI
Returns:
a list of all the registered Private Companies

getAllPublicCompanies

public java.util.List<PublicCompanyI> getAllPublicCompanies()
Description copied from interface: CompanyManagerI
Gives a list of all the registered Private Companies.

Specified by:
getAllPublicCompanies in interface CompanyManagerI
Returns:
a list of all the registered Private Companies

getCompanyTypes

public java.util.List<CompanyTypeI> getCompanyTypes()
Specified by:
getCompanyTypes in interface CompanyManagerI

getCompany

public CompanyI getCompany(java.lang.String type,
                           java.lang.String name)
Description copied from interface: CompanyManagerI
Find a company by type and name

Specified by:
getCompany in interface CompanyManagerI
Parameters:
type - The name of the CompanyType
name - The name of the Company
Returns:
The company object, or null if not found.

closeAllPrivates

public void closeAllPrivates()
Specified by:
closeAllPrivates in interface CompanyManagerI

getPrivatesOwnedByPlayers

public java.util.List<PrivateCompanyI> getPrivatesOwnedByPlayers()
Specified by:
getPrivatesOwnedByPlayers in interface CompanyManagerI

getStartPacket

public StartPacket getStartPacket(int index)
Specified by:
getStartPacket in interface CompanyManagerI

getStartPacket

public StartPacket getStartPacket(java.lang.String name)
Specified by:
getStartPacket in interface CompanyManagerI