rails.game
Class PhaseManager

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

public class PhaseManager
extends java.lang.Object
implements ConfigurableComponentI


Field Summary
protected  State currentPhase
           
protected  GameManagerI gameManager
           
protected static org.apache.log4j.Logger log
           
protected  int numberOfPhases
           
protected  java.util.ArrayList<Phase> phaseList
           
protected  java.util.HashMap<java.lang.String,Phase> phaseMap
           
 
Constructor Summary
PhaseManager()
           
 
Method Summary
 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.
 PhaseI getCurrentPhase()
           
 int getCurrentPhaseIndex()
           
 PhaseI getPhaseByName(java.lang.String name)
           
 java.util.List<Phase> getPhases()
           
 boolean hasReachedPhase(java.lang.String phaseName)
           
protected  void setPhase(PhaseI phase)
           
 void setPhase(java.lang.String name)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

phaseList

protected java.util.ArrayList<Phase> phaseList

phaseMap

protected java.util.HashMap<java.lang.String,Phase> phaseMap

numberOfPhases

protected int numberOfPhases

currentPhase

protected State currentPhase

gameManager

protected GameManagerI gameManager

log

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

PhaseManager

public PhaseManager()
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.

getCurrentPhase

public PhaseI getCurrentPhase()

getCurrentPhaseIndex

public int getCurrentPhaseIndex()

setPhase

public void setPhase(java.lang.String name)

setPhase

protected void setPhase(PhaseI phase)

getPhaseByName

public PhaseI getPhaseByName(java.lang.String name)

hasReachedPhase

public boolean hasReachedPhase(java.lang.String phaseName)

getPhases

public java.util.List<Phase> getPhases()