rails.game.special
Class SpecialProperty

java.lang.Object
  extended by rails.game.special.SpecialProperty
All Implemented Interfaces:
ConfigurableComponentI, Moveable, SpecialPropertyI
Direct Known Subclasses:
ExchangeForShare, LocatedBonus, NameTrains, SellBonusToken, SpecialTileLay, SpecialTokenLay, SpecialTrainBuy

public abstract class SpecialProperty
extends java.lang.Object
implements SpecialPropertyI


Nested Class Summary
 
Nested classes/interfaces inherited from interface rails.game.special.SpecialPropertyI
SpecialPropertyI.Priority
 
Field Summary
protected  int closingValue
           
protected  java.lang.String conditionText
           
protected  java.lang.String description
          Optional descriptive text, for display in menus and info text.
protected  BooleanState exercised
           
protected  GameManagerI gameManager
          To give subclasses access to the various 'managers'
protected  MoveableHolder holder
           
protected  boolean isORProperty
           
protected  boolean isSRProperty
           
protected static int lastIndex
           
protected static org.apache.log4j.Logger log
           
protected  CompanyI originalCompany
           
protected  boolean permanent
           
protected  SpecialPropertyI.Priority priority
          Priority indicates whether or not the UI should assign priority to the execution of a PossibleAction.
protected static java.util.Map<java.lang.Integer,SpecialPropertyI> spMap
           
protected  java.lang.String transferText
           
protected  int uniqueId
           
protected  boolean usableDuringOR
           
protected  boolean usableDuringSR
           
protected  boolean usableDuringTileLayingStep
           
protected  boolean usableDuringTokenLayingStep
           
protected  boolean usableIfOwnedByCompany
           
protected  boolean usableIfOwnedByPlayer
           
protected  java.lang.String whenText
           
 
Fields inherited from interface rails.game.special.SpecialPropertyI
DEFAULT_PRIORITY
 
Fields inherited from interface rails.game.move.Moveable
AT_END
 
Constructor Summary
SpecialProperty()
           
 
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.
static SpecialPropertyI getByUniqueId(int i)
           
 int getClosingValue()
           
 java.lang.String getHelp()
          Default Help text: "You can " + the menu description
 MoveableHolder getHolder()
           
 java.lang.String getInfo()
          Default Info text.
 CompanyI getOriginalCompany()
           
 SpecialPropertyI.Priority getPriority()
           
 java.lang.String getTransferText()
           
 int getUniqueId()
           
static void init()
           
 boolean isExercised()
           
 boolean isORProperty()
           
 boolean isSRProperty()
           
 boolean isUsableDuringOR()
           
 boolean isUsableDuringSR()
           
 boolean isUsableDuringTileLayingStep()
           
 boolean isUsableDuringTokenLayingStep()
           
 boolean isUsableIfOwnedByCompany()
           
 boolean isUsableIfOwnedByPlayer()
           
 void moveTo(MoveableHolder newHolder)
          Move the special property to another holder.
 void setCompany(CompanyI company)
           
 void setExercised()
           
 void setExercised(boolean value)
           
 void setHolder(MoveableHolder holder)
           
 void setPriority(SpecialPropertyI.Priority priority)
           
 void setUsableDuringOR(boolean usableDuringOR)
           
 void setUsableDuringSR(boolean usableDuringSR)
           
 void setUsableDuringTileLayingStep(boolean usableDuringTileLayingStep)
           
 void setUsableDuringTokenLayingStep(boolean usableDuringTokenLayingStep)
           
 void setUsableIfOwnedByCompany(boolean usableIfOwnedByCompany)
           
 void setUsableIfOwnedByPlayer(boolean usableIfOwnedByPlayer)
           
 java.lang.String toMenu()
          Default menu item text, should be by all special properties that can appear as a menu item
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface rails.game.special.SpecialPropertyI
getName, isExecutionable
 

Field Detail

originalCompany

protected CompanyI originalCompany

holder

protected MoveableHolder holder

closingValue

protected int closingValue

exercised

protected BooleanState exercised

usableIfOwnedByPlayer

protected boolean usableIfOwnedByPlayer

usableIfOwnedByCompany

protected boolean usableIfOwnedByCompany

usableDuringSR

protected boolean usableDuringSR

usableDuringOR

protected boolean usableDuringOR

usableDuringTileLayingStep

protected boolean usableDuringTileLayingStep

usableDuringTokenLayingStep

protected boolean usableDuringTokenLayingStep

conditionText

protected java.lang.String conditionText

whenText

protected java.lang.String whenText

transferText

protected java.lang.String transferText

permanent

protected boolean permanent

isORProperty

protected boolean isORProperty

isSRProperty

protected boolean isSRProperty

priority

protected SpecialPropertyI.Priority priority
Priority indicates whether or not the UI should assign priority to the execution of a PossibleAction. For instance, if the same tile can be laid on a hex using this special property, and by not using it, this attribute indicates which option will be used. TODO A third value means: ask the user (NOT YET IMPLEMENTED).


description

protected java.lang.String description
Optional descriptive text, for display in menus and info text. Subclasses may put real text in it.


uniqueId

protected int uniqueId

gameManager

protected GameManagerI gameManager
To give subclasses access to the various 'managers'


spMap

protected static java.util.Map<java.lang.Integer,SpecialPropertyI> spMap

lastIndex

protected static int lastIndex

log

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

SpecialProperty

public SpecialProperty()
Method Detail

init

public static void init()

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)
                         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

getUniqueId

public int getUniqueId()
Specified by:
getUniqueId in interface SpecialPropertyI

getByUniqueId

public static SpecialPropertyI getByUniqueId(int i)

setCompany

public void setCompany(CompanyI company)
Specified by:
setCompany in interface SpecialPropertyI

getOriginalCompany

public CompanyI getOriginalCompany()
Specified by:
getOriginalCompany in interface SpecialPropertyI

setHolder

public void setHolder(MoveableHolder holder)
Specified by:
setHolder in interface SpecialPropertyI

getHolder

public MoveableHolder getHolder()
Specified by:
getHolder in interface Moveable
Specified by:
getHolder in interface SpecialPropertyI

isUsableIfOwnedByCompany

public boolean isUsableIfOwnedByCompany()
Specified by:
isUsableIfOwnedByCompany in interface SpecialPropertyI
Returns:
Returns the usableIfOwnedByCompany.

setUsableIfOwnedByCompany

public void setUsableIfOwnedByCompany(boolean usableIfOwnedByCompany)
Specified by:
setUsableIfOwnedByCompany in interface SpecialPropertyI
Parameters:
usableIfOwnedByCompany - The usableIfOwnedByCompany to set.

isUsableIfOwnedByPlayer

public boolean isUsableIfOwnedByPlayer()
Specified by:
isUsableIfOwnedByPlayer in interface SpecialPropertyI
Returns:
Returns the usableIfOwnedByPlayer.

setUsableIfOwnedByPlayer

public void setUsableIfOwnedByPlayer(boolean usableIfOwnedByPlayer)
Specified by:
setUsableIfOwnedByPlayer in interface SpecialPropertyI
Parameters:
usableIfOwnedByPlayer - The usableIfOwnedByPlayer to set.

isUsableDuringOR

public boolean isUsableDuringOR()
Specified by:
isUsableDuringOR in interface SpecialPropertyI

setUsableDuringOR

public void setUsableDuringOR(boolean usableDuringOR)
Specified by:
setUsableDuringOR in interface SpecialPropertyI

isUsableDuringSR

public boolean isUsableDuringSR()
Specified by:
isUsableDuringSR in interface SpecialPropertyI

setUsableDuringSR

public void setUsableDuringSR(boolean usableDuringSR)
Specified by:
setUsableDuringSR in interface SpecialPropertyI

isUsableDuringTileLayingStep

public boolean isUsableDuringTileLayingStep()
Specified by:
isUsableDuringTileLayingStep in interface SpecialPropertyI

setUsableDuringTileLayingStep

public void setUsableDuringTileLayingStep(boolean usableDuringTileLayingStep)
Specified by:
setUsableDuringTileLayingStep in interface SpecialPropertyI

isUsableDuringTokenLayingStep

public boolean isUsableDuringTokenLayingStep()
Specified by:
isUsableDuringTokenLayingStep in interface SpecialPropertyI

setUsableDuringTokenLayingStep

public void setUsableDuringTokenLayingStep(boolean usableDuringTokenLayingStep)
Specified by:
setUsableDuringTokenLayingStep in interface SpecialPropertyI

setExercised

public void setExercised()
Specified by:
setExercised in interface SpecialPropertyI

setExercised

public void setExercised(boolean value)

isExercised

public boolean isExercised()
Specified by:
isExercised in interface SpecialPropertyI

getClosingValue

public int getClosingValue()

isSRProperty

public boolean isSRProperty()
Specified by:
isSRProperty in interface SpecialPropertyI

isORProperty

public boolean isORProperty()
Specified by:
isORProperty in interface SpecialPropertyI

getTransferText

public java.lang.String getTransferText()
Specified by:
getTransferText in interface SpecialPropertyI

getPriority

public SpecialPropertyI.Priority getPriority()
Specified by:
getPriority in interface SpecialPropertyI

setPriority

public void setPriority(SpecialPropertyI.Priority priority)
Specified by:
setPriority in interface SpecialPropertyI

moveTo

public void moveTo(MoveableHolder newHolder)
Move the special property to another holder. Only to be used for special properties that have the "transfer" attribute.

Specified by:
moveTo in interface Moveable
Specified by:
moveTo in interface SpecialPropertyI

toString

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

toMenu

public java.lang.String toMenu()
Default menu item text, should be by all special properties that can appear as a menu item

Specified by:
toMenu in interface SpecialPropertyI

getInfo

public java.lang.String getInfo()
Default Info text. To be overridden where useful.

Specified by:
getInfo in interface SpecialPropertyI

getHelp

public java.lang.String getHelp()
Default Help text: "You can " + the menu description