private IMovement MoveConvoy(IYardLocomotive locomotive, ILinesMap map, IDecrementableLine origin, IIncrementableLine destination, int amount) { locomotive.LoadCarsFromLine(origin, amount); var movement = new Movement(origin, destination, locomotive.Cars.AsEnumerable<INamed>().ToList()); map.UpdateDepths(origin as ISortingLine, -movement.Cars.Count()); locomotive.UnloadAllCarsIntoLine(destination); map.UpdateDepths(destination as ISortingLine, movement.Cars.Count()); return movement; }
private IMovement MoveConvoy(IYardLocomotive locomotive, ILinesMap map, IDecrementableLine origin, IIncrementableLine destination, int amount) { locomotive.LoadCarsFromLine(origin, amount); var movement = new Movement(origin, destination, locomotive.Cars.AsEnumerable <INamed>().ToList()); map.UpdateDepths(origin as ISortingLine, -movement.Cars.Count()); locomotive.UnloadAllCarsIntoLine(destination); map.UpdateDepths(destination as ISortingLine, movement.Cars.Count()); return(movement); }
/// <summary> /// Constructor /// </summary> /// <param name="yardLocomotive">A locomotive that will move cars</param> public Yardmaster(IYardLocomotive yardLocomotive) { YardLocomotive = yardLocomotive; }
/// <summary> /// Constructor /// </summary> /// <param name="yardLocomotive">A locomotive that will move cars</param> public Yardmaster(IYardLocomotive yardLocomotive) { YardLocomotive = yardLocomotive; }