jfreerails.controller
Class TrainStopsHandler

java.lang.Object
  extended by jfreerails.controller.TrainStopsHandler
All Implemented Interfaces:
java.io.Serializable

public class TrainStopsHandler
extends java.lang.Object
implements java.io.Serializable

Author:
Luke
See Also:
Serialized Form

Field Summary
private static java.util.logging.Logger logger
           
private static int NOT_AT_STATION
           
private  FreerailsPrincipal principal
           
private static long serialVersionUID
           
private  GameTime timeLoadingFinished
           
private  int trainId
           
private  WorldDiffs worldDiffs
           
 
Constructor Summary
TrainStopsHandler(int id, FreerailsPrincipal p, WorldDiffs w)
           
 
Method Summary
 ImPoint arrivesAtPoint(int x, int y)
           
 Move getMoves()
           
 int getStationID(int x, int y)
           
 int getTrainLength()
           
 boolean isTrainFull()
           
 boolean isTrainMoving()
           
 boolean isWaiting4FullLoad()
           
(package private) static PathOnTiles lengthenPath(ReadOnlyWorld w, PathOnTiles path, int currentTrainLength)
          If wagons are added to a train, we need to increase its length.
(package private)  void loadAndUnloadCargo(int stationId, boolean waiting, boolean autoConsist)
           
(package private)  void makeTrainWait(int ticks)
           
 boolean refreshWaitingForFullLoad()
           
private  void scheduledStop()
           
(package private)  void updateSchedule()
           
 void updateTarget()
          Issues a ChangeTrainScheduleMove to set the train to move to the next station.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

NOT_AT_STATION

private static final int NOT_AT_STATION
See Also:
Constant Field Values

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

principal

private final FreerailsPrincipal principal

timeLoadingFinished

private GameTime timeLoadingFinished

trainId

private final int trainId

worldDiffs

private final WorldDiffs worldDiffs
Constructor Detail

TrainStopsHandler

public TrainStopsHandler(int id,
                         FreerailsPrincipal p,
                         WorldDiffs w)
Method Detail

lengthenPath

static PathOnTiles lengthenPath(ReadOnlyWorld w,
                                PathOnTiles path,
                                int currentTrainLength)
If wagons are added to a train, we need to increase its length.


arrivesAtPoint

public ImPoint arrivesAtPoint(int x,
                              int y)

getMoves

public Move getMoves()

getStationID

public int getStationID(int x,
                        int y)
Returns:
the number of the station the train is currently at, or -1 if no current station.

getTrainLength

public int getTrainLength()

isTrainFull

public boolean isTrainFull()

isTrainMoving

public boolean isTrainMoving()

isWaiting4FullLoad

public boolean isWaiting4FullLoad()

loadAndUnloadCargo

void loadAndUnloadCargo(int stationId,
                        boolean waiting,
                        boolean autoConsist)

makeTrainWait

void makeTrainWait(int ticks)

refreshWaitingForFullLoad

public boolean refreshWaitingForFullLoad()

scheduledStop

private void scheduledStop()

updateSchedule

void updateSchedule()

updateTarget

public void updateTarget()
Issues a ChangeTrainScheduleMove to set the train to move to the next station.