rails.game
Class Train

java.lang.Object
  extended by rails.game.Train
All Implemented Interfaces:
Moveable, TrainI
Direct Known Subclasses:
NameableTrain

public class Train
extends java.lang.Object
implements TrainI


Field Summary
protected  int cityScoreFactor
           
protected  int cost
           
protected  Portfolio holder
           
protected static org.apache.log4j.Logger log
           
protected  int majorStops
           
protected  int minorStops
           
protected  BooleanState obsolete
           
protected  int townCountIndicator
           
protected  int townScoreFactor
           
protected  boolean tradeable
          Some specific trains cannot be traded between companies
protected  TrainTypeI type
           
protected  java.lang.String uniqueId
           
 
Fields inherited from interface rails.game.move.Moveable
AT_END
 
Constructor Summary
Train()
           
 
Method Summary
 boolean canBeExchanged()
           
 int getCityScoreFactor()
           
 int getCost()
           
 Portfolio getHolder()
           
 int getMajorStops()
           
 int getMinorStops()
           
 java.lang.String getName()
           
 CashHolder getOwner()
           
 int getTownCountIndicator()
           
 int getTownScoreFactor()
           
 TrainTypeI getType()
           
 java.lang.String getUniqueId()
           
 void init(TrainTypeI type, int index)
           
 boolean isObsolete()
           
 boolean isTradeable()
           
 void moveTo(MoveableHolder to)
           
 void setHolder(Portfolio newHolder)
          Move the train to another Portfolio.
 void setObsolete()
           
 void setRusted()
           
 void setTradeable(boolean tradeable)
           
 java.lang.String toDisplay()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected TrainTypeI type

majorStops

protected int majorStops

minorStops

protected int minorStops

cost

protected int cost

cityScoreFactor

protected int cityScoreFactor

townScoreFactor

protected int townScoreFactor

townCountIndicator

protected int townCountIndicator

tradeable

protected boolean tradeable
Some specific trains cannot be traded between companies


uniqueId

protected java.lang.String uniqueId

holder

protected Portfolio holder

obsolete

protected BooleanState obsolete

log

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

Train

public Train()
Method Detail

init

public void init(TrainTypeI type,
                 int index)
Specified by:
init in interface TrainI

getUniqueId

public java.lang.String getUniqueId()
Specified by:
getUniqueId in interface TrainI

getCityScoreFactor

public int getCityScoreFactor()
Specified by:
getCityScoreFactor in interface TrainI
Returns:
Returns the cityScoreFactor.

getCost

public int getCost()
Specified by:
getCost in interface TrainI
Returns:
Returns the cost.

getMajorStops

public int getMajorStops()
Specified by:
getMajorStops in interface TrainI
Returns:
Returns the majorStops.

getMinorStops

public int getMinorStops()
Specified by:
getMinorStops in interface TrainI
Returns:
Returns the minorStops.

getTownCountIndicator

public int getTownCountIndicator()
Specified by:
getTownCountIndicator in interface TrainI
Returns:
Returns the townCountIndicator.

getTownScoreFactor

public int getTownScoreFactor()
Specified by:
getTownScoreFactor in interface TrainI
Returns:
Returns the townScoreFactor.

getType

public TrainTypeI getType()
Specified by:
getType in interface TrainI
Returns:
Returns the type.

getName

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

getHolder

public Portfolio getHolder()
Specified by:
getHolder in interface Moveable
Specified by:
getHolder in interface TrainI

getOwner

public CashHolder getOwner()
Specified by:
getOwner in interface TrainI

isObsolete

public boolean isObsolete()
Specified by:
isObsolete in interface TrainI

setHolder

public void setHolder(Portfolio newHolder)
Move the train to another Portfolio.

Specified by:
setHolder in interface TrainI

moveTo

public void moveTo(MoveableHolder to)
Specified by:
moveTo in interface Moveable

setRusted

public void setRusted()
Specified by:
setRusted in interface TrainI

setObsolete

public void setObsolete()
Specified by:
setObsolete in interface TrainI

canBeExchanged

public boolean canBeExchanged()
Specified by:
canBeExchanged in interface TrainI

toDisplay

public java.lang.String toDisplay()
Specified by:
toDisplay in interface TrainI

isTradeable

public boolean isTradeable()
Specified by:
isTradeable in interface TrainI

setTradeable

public void setTradeable(boolean tradeable)
Specified by:
setTradeable in interface TrainI