Ejemplo n.º 1
0
 private void HandleSummonForBoundaries(IList <SummonInformation> requests, TravelDirection direction, Boundaries boundaries, IList <SummonInformation> selectedSummons)
 {
     foreach (var summon in requests)
     {
         if (boundaries.IsExtremum(direction, summon.SummonFloor))
         {
             selectedSummons.Add(summon);
         }
     }
 }
Ejemplo n.º 2
0
        private IList <SummonInformation> GetAllSummonsForDirectionOfTravelInBoundaries(IList <SummonInformation> requests, TravelDirection direction, Boundaries boundaries)
        {
            var selectedSummons = requests.Where(summon =>
            {
                return(!boundaries.IsExtremum(direction, summon.SummonFloor) &&
                       IsSummonRequestInBoundariesAndMatchingDirection(summon, direction, boundaries));
            }).ToList();

            return(direction == TravelDirection.Up
                        ? selectedSummons.OrderBy(summon => summon.SummonFloor).ToList()
                        : selectedSummons.OrderByDescending(summon => summon.SummonFloor).ToList());
        }