rails.game
Class BonusToken

java.lang.Object
  extended by rails.game.Token
      extended by rails.game.BonusToken
All Implemented Interfaces:
Closeable, ConfigurableComponentI, Moveable, TokenI

public class BonusToken
extends Token
implements Closeable, ConfigurableComponentI

A BonusToken object represents a token that a operating public company can place on the map to gain extra revenue or other privileges.

Such tokens are usually not placed in city slots, which are intended for base tokens, but on some unoccupied part of a tile.

Author:
Erik Vos

Field Summary
(package private)  java.lang.String name
           
(package private)  java.lang.Object removingObject
           
(package private)  java.lang.String removingObjectDesc
           
(package private)  PublicCompanyI user
           
(package private)  int value
           
 
Fields inherited from class rails.game.Token
description, holder, log, uniqueId
 
Fields inherited from interface rails.game.move.Moveable
AT_END
 
Constructor Summary
BonusToken()
          Create a BonusToken.
 
Method Summary
 void close()
          Remove the token.
 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.lang.String getClosingInfo()
           
 java.lang.String getName()
           
 int getValue()
           
 boolean isPlaced()
           
 void prepareForRemoval(PhaseManager phaseManager)
          Prepare the bonus token for removal, if so configured.
 void setUser(PublicCompanyI user)
           
 java.lang.String toString()
           
 
Methods inherited from class rails.game.Token
equals, getByUniqueId, getHolder, getUniqueId, init, moveTo, setHolder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

int value

name

java.lang.String name

removingObjectDesc

java.lang.String removingObjectDesc

removingObject

java.lang.Object removingObject

user

PublicCompanyI user
Constructor Detail

BonusToken

public BonusToken()
Create a BonusToken.

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

finishConfiguration

public void finishConfiguration(GameManagerI gameManager)
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.

close

public void close()
Remove the token. This method can be called by a certain phase when it starts. See prepareForRemovel().

Specified by:
close in interface Closeable

prepareForRemoval

public void prepareForRemoval(PhaseManager phaseManager)
Prepare the bonus token for removal, if so configured. The only case currently implemented to trigger removal is the start of a given phase.


setUser

public void setUser(PublicCompanyI user)

isPlaced

public boolean isPlaced()

getName

public java.lang.String getName()
Specified by:
getName in interface Moveable
Specified by:
getName in interface TokenI

getValue

public int getValue()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getClosingInfo

public java.lang.String getClosingInfo()
Specified by:
getClosingInfo in interface Closeable