rails.game
Class Company

java.lang.Object
  extended by rails.game.Company
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<Company>, CompanyI, ConfigurableComponentI, MoveableHolder
Direct Known Subclasses:
PrivateCompany, PublicCompany

public abstract class Company
extends java.lang.Object
implements CompanyI, ConfigurableComponentI, java.lang.Cloneable, java.lang.Comparable<Company>


Field Summary
protected  java.lang.String alias
           
protected  int certLimitCount
          Twice the amount each certificate counts against the limit (this way we take care for certs that count for 0.5)
protected  BooleanState closedObject
          Closed state
protected  int companyNumber
           
protected  java.lang.String infoText
           
protected static org.apache.log4j.Logger log
           
protected  java.lang.String longName
           
protected  java.lang.String name
           
protected  java.lang.String parentInfoText
           
protected  Portfolio portfolio
           
protected  java.util.List<SpecialPropertyI> specialProperties
           
protected  CompanyTypeI type
           
protected  int value
          The value per certificate at the end of the rails.game.
 
Fields inherited from interface rails.game.CompanyI
COMPANY_ELEMENT_ID, COMPANY_NAME_TAG, COMPANY_TYPE_TAG
 
Constructor Summary
Company()
           
 
Method Summary
 boolean addToken(CompanyI company, int position)
          Stub method implemented to comply with TokenHolderI interface.
 java.lang.Object clone()
           
 int compareTo(Company otherCompany)
           
 void configureFromXML(Tag tag)
          Only to be called from subclasses
 boolean equals(CompanyI company)
           
 java.lang.String getAlias()
           
 int getCertLimitCount()
           
 int getCompanyNumber()
           
 MoveableHolder getHolder()
           
 java.lang.String getInfoText()
           
 java.lang.String getLongName()
           
 java.lang.String getName()
          Returns the name of the Company
 int getNumber()
           
 Portfolio getPortfolio()
          Get the Portfolio of this company, containing all privates and certificates owned..
 java.util.List<SpecialPropertyI> getSpecialProperties()
           
 CompanyTypeI getType()
          Returns the CompanyType of the Company
 java.lang.String getTypeName()
          Returns the type name of the Company
 int getValue()
           
 boolean hasSpecialProperties()
          Do we have any special properties?
 void init(java.lang.String name, CompanyTypeI type)
           
 boolean isClosed()
           
static java.lang.String joinNamesWithDelimiter(java.util.List<CompanyI> companies, java.lang.String delimiter)
           
 void setCertLimitCount(int i)
           
 void setClosed()
          Close this company.
 void setValue(int i)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface rails.game.ConfigurableComponentI
finishConfiguration
 
Methods inherited from interface rails.game.move.MoveableHolder
addObject, getListIndex, removeObject
 

Field Detail

name

protected java.lang.String name

longName

protected java.lang.String longName

alias

protected java.lang.String alias

type

protected CompanyTypeI type

companyNumber

protected int companyNumber

portfolio

protected Portfolio portfolio

infoText

protected java.lang.String infoText

parentInfoText

protected java.lang.String parentInfoText

value

protected int value
The value per certificate at the end of the rails.game. Default 0 (for privates).


certLimitCount

protected int certLimitCount
Twice the amount each certificate counts against the limit (this way we take care for certs that count for 0.5)


closedObject

protected BooleanState closedObject
Closed state


specialProperties

protected java.util.List<SpecialPropertyI> specialProperties

log

protected static org.apache.log4j.Logger log
Constructor Detail

Company

public Company()
Method Detail

init

public void init(java.lang.String name,
                 CompanyTypeI type)
Specified by:
init in interface CompanyI

configureFromXML

public void configureFromXML(Tag tag)
                      throws ConfigurationException
Only to be called from subclasses

Specified by:
configureFromXML in interface ConfigurableComponentI
Throws:
ConfigurationException

getSpecialProperties

public java.util.List<SpecialPropertyI> getSpecialProperties()
Specified by:
getSpecialProperties in interface CompanyI
Returns:
ArrayList of all special properties we have.

hasSpecialProperties

public boolean hasSpecialProperties()
Do we have any special properties?

Specified by:
hasSpecialProperties in interface CompanyI
Returns:
Boolean

getPortfolio

public Portfolio getPortfolio()
Get the Portfolio of this company, containing all privates and certificates owned..

Specified by:
getPortfolio in interface CompanyI
Returns:
The Portfolio of this company.

getNumber

public int getNumber()
Returns:
This company's number

isClosed

public boolean isClosed()
Specified by:
isClosed in interface CompanyI
Returns:
whether this company is closed

setClosed

public void setClosed()
Close this company.

Specified by:
setClosed in interface CompanyI

getType

public CompanyTypeI getType()
Description copied from interface: CompanyI
Returns the CompanyType of the Company

Specified by:
getType in interface CompanyI
Returns:
Type of company (Public/Private)

getTypeName

public java.lang.String getTypeName()
Description copied from interface: CompanyI
Returns the type name of the Company

Specified by:
getTypeName in interface CompanyI
Returns:
String for type of company (Public/Private)

getName

public java.lang.String getName()
Description copied from interface: CompanyI
Returns the name of the Company

Specified by:
getName in interface CompanyI
Specified by:
getName in interface MoveableHolder
Returns:
Name of company

getLongName

public java.lang.String getLongName()
Specified by:
getLongName in interface CompanyI

getAlias

public java.lang.String getAlias()
Specified by:
getAlias in interface CompanyI

getInfoText

public java.lang.String getInfoText()
Specified by:
getInfoText in interface CompanyI

getCertLimitCount

public int getCertLimitCount()
Specified by:
getCertLimitCount in interface CompanyI
Returns:

getCompanyNumber

public int getCompanyNumber()
Specified by:
getCompanyNumber in interface CompanyI
Returns:
This company's number

getValue

public int getValue()
Specified by:
getValue in interface CompanyI
Returns:
Value of this company

setCertLimitCount

public void setCertLimitCount(int i)
Specified by:
setCertLimitCount in interface CompanyI
Parameters:
i -

setValue

public void setValue(int i)
Specified by:
setValue in interface CompanyI
Parameters:
i -

getHolder

public MoveableHolder getHolder()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Specified by:
clone in interface CompanyI
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

addToken

public boolean addToken(CompanyI company,
                        int position)
Stub method implemented to comply with TokenHolderI interface. Always returns false. Use addToken(MapHex hex) method instead.


toString

public java.lang.String toString()
Specified by:
toString in interface CompanyI
Overrides:
toString in class java.lang.Object

equals

public boolean equals(CompanyI company)
Specified by:
equals in interface CompanyI

compareTo

public int compareTo(Company otherCompany)
Specified by:
compareTo in interface java.lang.Comparable<Company>

joinNamesWithDelimiter

public static java.lang.String joinNamesWithDelimiter(java.util.List<CompanyI> companies,
                                                      java.lang.String delimiter)