jfreerails.controller
Class DropOffAndPickupCargoMoveGenerator
java.lang.Object
jfreerails.controller.DropOffAndPickupCargoMoveGenerator
public class DropOffAndPickupCargoMoveGenerator
- extends java.lang.Object
This class generates moves that transfer cargo between train and the stations
it stops at - it also handles cargo conversions that occur when cargo is
dropped off.
- Author:
- Scott Bennett, Luke Lindsay Date Created: 4 June 2003
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
w
private final ReadOnlyWorld w
train
private final TrainAccessor train
trainId
private final int trainId
trainBundleId
private int trainBundleId
stationId
private final int stationId
stationBundleId
private int stationBundleId
stationAfter
private MutableCargoBundle stationAfter
stationBefore
private MutableCargoBundle stationBefore
trainAfter
private MutableCargoBundle trainAfter
trainBefore
private MutableCargoBundle trainBefore
moves
private java.util.ArrayList<Move> moves
principal
private final FreerailsPrincipal principal
waitingForFullLoad
private boolean waitingForFullLoad
autoConsist
private boolean autoConsist
consist
private ImInts consist
DropOffAndPickupCargoMoveGenerator
public DropOffAndPickupCargoMoveGenerator(int trainNo,
int stationNo,
ReadOnlyWorld world,
FreerailsPrincipal p,
boolean waiting,
boolean autoConsist)
- Contructor.
- Parameters:
trainNo
- ID of the trainstationNo
- ID of the stationworld
- The world object
generateMove
public Move generateMove()
getBundles
private void getBundles()
getCopyOfBundle
private MutableCargoBundle getCopyOfBundle(int id)
processTrainBundle
private void processTrainBundle()
processStationBundle
private void processStationBundle()
- Transfer cargo from the station to the train subject to the space available on the train.
isCargo2Transfer
public boolean isCargo2Transfer()
transferCargo
private static void transferCargo(int cargoTypeToTransfer,
int amountToTransfer,
MutableCargoBundle from,
MutableCargoBundle to)
- Move the specified quantity of the specifed cargotype from one bundle to
another.