예제 #1
0
        public Journey[] FindJourneysByFilter(string portFrom, string portTo, JourneyFilter filterType, int value)
        {
            var journeys = CreatePossibleJourneysBetweenPorts(portFrom, portTo);

            switch (filterType)
            {
                case JourneyFilter.MinStops:
                    journeys = journeys.Where(j => j.Routes.Count >= value).ToArray();
                    break;
                case JourneyFilter.MaxStops:
                    journeys = journeys.Where(j => j.Routes.Count <= value).ToArray();
                    break;
                case JourneyFilter.ExactStops:
                    journeys = journeys.Where(j => j.Routes.Count == value).ToArray();
                    break;
                case JourneyFilter.MinDuration:
                    journeys = journeys.Where(j => j.Duration >= value).ToArray();
                    break;
                case JourneyFilter.MaxDuration:
                    journeys = journeys.Where(j => j.Duration <= value).ToArray();
                    break;
            }

            return journeys;
        }
예제 #2
0
        public Journey[] FindJourneysByFilter(string portFrom, string portTo, JourneyFilter filterType, int value)
        {
            var journeys = CreatePossibleJourneysBetweenPorts(portFrom, portTo);

            switch (filterType)
            {
            case JourneyFilter.MinStops:
                journeys = journeys.Where(j => j.Routes.Count >= value).ToArray();
                break;

            case JourneyFilter.MaxStops:
                journeys = journeys.Where(j => j.Routes.Count <= value).ToArray();
                break;

            case JourneyFilter.ExactStops:
                journeys = journeys.Where(j => j.Routes.Count == value).ToArray();
                break;

            case JourneyFilter.MinDuration:
                journeys = journeys.Where(j => j.Duration >= value).ToArray();
                break;

            case JourneyFilter.MaxDuration:
                journeys = journeys.Where(j => j.Duration <= value).ToArray();
                break;
            }

            return(journeys);
        }
예제 #3
0
 public SelectionParameters(SelectionSeverity severity, int nRequired = 0, bool getMaxData = false, bool useJourney = true, JourneyFilter journeyFilter = JourneyFilter.CurrentJourney, PackListHistory packListHistory = PackListHistory.NoFilter, List <string> filteringIds = null, bool sortDataByDifficulty = false)
 {
     this.nRequired            = nRequired;
     this.getMaxData           = getMaxData;
     this.severity             = severity;
     this.useJourney           = useJourney;
     this.journeyFilter        = journeyFilter;
     this.packListHistory      = packListHistory;
     this.filteringIds         = filteringIds;
     this.sortDataByDifficulty = sortDataByDifficulty;
 }
예제 #4
0
 public void AssignJourney(bool insideJourney)
 {
     journeyFilter  = JourneyFilter.CurrentJourney;
     priorityFilter = insideJourney ? PriorityFilter.CurrentThenPast : PriorityFilter.NoPriority;
 }