Exemplo n.º 1
0
 public void RegisterElevatorCar(ElevatorCar elevatorCar)
 {
     if (!this.ElevatorCarList.Any(e => e.Name.Equals(elevatorCar.Name)))
     {
         this.ElevatorCarList.Add(elevatorCar);
     }
 }
        public int GetImmediateDestinationFloorToService(ElevatorCar elevatorCar)
        {
            var elevatorSR = this.ServiceRequestPipeLine.Values.Cast <ElevatorServiceRequest>()
                             .Where(e => e.ElevatorName.Equals(elevatorCar.Name))
                             .ToList <ElevatorServiceRequest>();

            bool bMoveUpwards = true;

            bMoveUpwards = elevatorSR.FirstOrDefault().ServiceRequestDirection == ElevatorDirection.Downwards ? false : true;

            return(bMoveUpwards ? elevatorSR.Min(sr => sr.DeistinationFloor) : elevatorSR.Max(sr => sr.DeistinationFloor));
        }