|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrails.game.CompanyType
public class CompanyType
Objects of this class represent a particular type of company, of which typically multiple instances exist in a rails.game. Examples: "Private", "Minor", "Major", "Mountain" etc.
This class contains common properties of the companies of one type, and aids in configuring the companies by reducing the need to repeatedly specify common properties with different companies.
Field Summary | |
---|---|
protected int |
capitalisation
|
protected java.lang.String |
className
|
protected java.util.List<CompanyI> |
companies
|
protected java.lang.String |
name
|
Fields inherited from interface rails.game.CompanyTypeI |
---|
ALL_CLOSE_TAG, AUCTION_TAG, CLASS_TAG, ELEMENT_ID, NAME_TAG |
Constructor Summary | |
---|---|
CompanyType(java.lang.String name,
java.lang.String className)
The constructor. |
Method Summary | |
---|---|
void |
configureFromXML(Tag tag)
Instructs the component to configure itself from the provided XML element. |
CompanyI |
createCompany(java.lang.String name,
Tag tag)
|
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. |
int |
getCapitalisation()
|
java.lang.String |
getClassName()
Get the name of the class that will implement this type of company. |
java.util.List<CompanyI> |
getCompanies()
|
CompanyI |
getDummyCompany()
|
java.lang.String |
getName()
Get the company type name |
void |
setCapitalisation(int mode)
|
void |
setCapitalisation(java.lang.String mode)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String name
protected java.lang.String className
protected int capitalisation
protected java.util.List<CompanyI> companies
Constructor Detail |
---|
public CompanyType(java.lang.String name, java.lang.String className)
name
- Company type name ("Private", "Public", "Minor" etc.).className
- Name of the class that will instantiate this type of
company.element
- The <CompanyType> DOM element, used to define this
company type.Method Detail |
---|
public void configureFromXML(Tag tag) throws ConfigurationException
ConfigurableComponentI
configureFromXML
in interface ConfigurableComponentI
ConfigurationException
rails.game.ConfigurableComponentI#configureFromXML(org.w3c.dom.Element)
public void finishConfiguration(GameManagerI gameManager)
ConfigurableComponentI
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.
finishConfiguration
in interface ConfigurableComponentI
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.public CompanyI createCompany(java.lang.String name, Tag tag) throws ConfigurationException
createCompany
in interface CompanyTypeI
ConfigurationException
public java.lang.String getName()
getName
in interface CompanyTypeI
public java.lang.String getClassName()
getClassName
in interface CompanyTypeI
public java.util.List<CompanyI> getCompanies()
getCompanies
in interface CompanyTypeI
public void setCapitalisation(int mode)
setCapitalisation
in interface CompanyTypeI
public void setCapitalisation(java.lang.String mode)
setCapitalisation
in interface CompanyTypeI
public int getCapitalisation()
getCapitalisation
in interface CompanyTypeI
public CompanyI getDummyCompany()
getDummyCompany
in interface CompanyTypeI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |