rails.game
Class TileManager

java.lang.Object
  extended by rails.game.TileManager
All Implemented Interfaces:
ConfigurableComponentI

public class TileManager
extends java.lang.Object
implements ConfigurableComponentI


Field Summary
protected static org.apache.log4j.Logger log
           
protected  java.util.List<java.lang.Integer> tileIds
           
protected  java.util.Map<java.lang.Integer,TileI> tileMap
           
 
Constructor Summary
TileManager()
          No-args constructor.
 
Method Summary
 void configureFromXML(Tag tileSetTop)
          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<TileI> getAllUpgrades(TileI tile, MapHex hex)
          returns the set of all possible upgrade tiles
 TileI getTile(int id)
           
 java.util.List<java.lang.Integer> getTileIds()
          Get the tile IDs in the XML definition sequence
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tileMap

protected java.util.Map<java.lang.Integer,TileI> tileMap

tileIds

protected java.util.List<java.lang.Integer> tileIds

log

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

TileManager

public TileManager()
No-args constructor.

Method Detail

configureFromXML

public void configureFromXML(Tag tileSetTop)
                      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

getTile

public TileI getTile(int id)

getTileIds

public java.util.List<java.lang.Integer> getTileIds()
Get the tile IDs in the XML definition sequence


getAllUpgrades

public java.util.List<TileI> getAllUpgrades(TileI tile,
                                            MapHex hex)
returns the set of all possible upgrade tiles