Example #1
0
        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;
        }
Example #2
0
        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);
        }
Example #3
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="yardLocomotive">A locomotive that will move cars</param>
 public Yardmaster(IYardLocomotive yardLocomotive)
 {
     YardLocomotive = yardLocomotive;
 }
Example #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="yardLocomotive">A locomotive that will move cars</param>
 public Yardmaster(IYardLocomotive yardLocomotive)
 {
     YardLocomotive = yardLocomotive;
 }