jfreerails.controller
Class TrackMoveProducer

java.lang.Object
  extended by jfreerails.controller.TrackMoveProducer

public final class TrackMoveProducer
extends java.lang.Object

Provides methods that generate moves that build, upgrade, and remove track.

Author:
Luke

Nested Class Summary
static class TrackMoveProducer.BuildMode
           
 
Field Summary
private  MoveExecutor executor
           
private  GameTime lastMoveTime
           
private  java.util.Stack<Move> moveStack
           
private  ModelRoot mr
           
private  TrackMoveTransactionsGenerator transactionsGenerator
          This generates the transactions - the charge - for the track being built.
 
Constructor Summary
TrackMoveProducer(ModelRoot mr)
           
TrackMoveProducer(MoveExecutor executor, ReadOnlyWorld world, ModelRoot mr)
           
 
Method Summary
 MoveStatus buildTrack(ImPoint from, Step trackVector)
           
 MoveStatus buildTrack(ImPoint from, Step[] path)
           
private  void clearStackIfStale()
          Moves are only un-doable if no game time has passed since they they were executed.
 TrackMoveProducer.BuildMode getBuildMode()
           
 BuildTrackStrategy getBuildTrackStrategy()
           
 TrackMoveProducer.BuildMode getTrackBuilderMode()
           
private  boolean isStationHere(ImPoint p)
           
private  MoveStatus sendMove(Move m)
           
 void setBuildMode(TrackMoveProducer.BuildMode buildMode)
           
 void setBuildTrackStrategy(BuildTrackStrategy buildTrackStrategy)
           
 void setTrackBuilderMode(TrackMoveProducer.BuildMode i)
           
 MoveStatus undoLastTrackMove()
           
 MoveStatus upgradeTrack(ImPoint point)
           
private  MoveStatus upgradeTrack(ImPoint point, int trackRuleID)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mr

private final ModelRoot mr

executor

private final MoveExecutor executor

moveStack

private final java.util.Stack<Move> moveStack

lastMoveTime

private GameTime lastMoveTime

transactionsGenerator

private final TrackMoveTransactionsGenerator transactionsGenerator
This generates the transactions - the charge - for the track being built.

Constructor Detail

TrackMoveProducer

public TrackMoveProducer(MoveExecutor executor,
                         ReadOnlyWorld world,
                         ModelRoot mr)

TrackMoveProducer

public TrackMoveProducer(ModelRoot mr)
Method Detail

buildTrack

public MoveStatus buildTrack(ImPoint from,
                             Step[] path)

buildTrack

public MoveStatus buildTrack(ImPoint from,
                             Step trackVector)

upgradeTrack

public MoveStatus upgradeTrack(ImPoint point)

setTrackBuilderMode

public void setTrackBuilderMode(TrackMoveProducer.BuildMode i)

upgradeTrack

private MoveStatus upgradeTrack(ImPoint point,
                                int trackRuleID)

undoLastTrackMove

public MoveStatus undoLastTrackMove()

clearStackIfStale

private void clearStackIfStale()
Moves are only un-doable if no game time has passed since they they were executed. This method clears the move stack if the moves were added to the stack at a time other than the current time.


getTrackBuilderMode

public TrackMoveProducer.BuildMode getTrackBuilderMode()

sendMove

private MoveStatus sendMove(Move m)

isStationHere

private boolean isStationHere(ImPoint p)

setBuildTrackStrategy

public void setBuildTrackStrategy(BuildTrackStrategy buildTrackStrategy)

getBuildTrackStrategy

public BuildTrackStrategy getBuildTrackStrategy()

setBuildMode

public void setBuildMode(TrackMoveProducer.BuildMode buildMode)

getBuildMode

public TrackMoveProducer.BuildMode getBuildMode()