public TimeSpan?GetGlobalTravelDuration(VehicleStationLocation startStation, VehicleStationLocation endStation, List <VehicleStationLocation> nonstopStations = null)
        {
            InvalidateDurationPerStation();
            TimeSpan?result = _durationPerStation.GetTravelTime(startStation, endStation, nonstopStations);

            if (result == null)
            {
                InvalidateDurationPerStation(true);
                result = _durationPerStation.GetTravelTime(startStation, endStation, nonstopStations);
            }
            return(result);
        }
コード例 #2
0
 /** tries to fill unknown travel and station loading times from own old values / another schedule part or from global values based on station locations */
 private void FillUnknownTimes()
 {
     foreach ((RootTask endStationTask, VehicleStationLocation startStation, VehicleStationLocation endStation, List <VehicleStationLocation> nonstopStations) in this.GetNonNonstopScheduleParts())
     {
         VehicleScheduleDataManager manager = Manager <VehicleScheduleDataManager> .Current;
         if (GetAverageTravelDuration(endStationTask) == null)
         {
             TimeSpan?duration = _durationPerStation?.GetTravelTime(startStation, endStation, nonstopStations);
             if (duration == null)
             {
                 duration = manager.GetGlobalTravelDuration(startStation, endStation, nonstopStations);
             }
             if (duration != null)
             {
                 _travelData.Add(endStationTask, duration.Value);
                 _travelData.MarkForOverwrite(endStationTask);
             }
         }
         if (GetAverageStationLoadingDuration(endStationTask) == null)
         {
             TimeSpan?duration = _durationPerStation?.GetStationTime(endStation);
             if (duration == null)
             {
                 duration = manager.GetGlobalStationDuration(endStation);
             }
             if (duration != null)
             {
                 _stationLoadingData.Add(endStationTask, duration.Value);
                 _stationLoadingData.MarkForOverwrite(endStationTask);
             }
         }
     }
 }