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); } } }
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()); }