public TimeSpan?GetGlobalStationDuration(VehicleStationLocation station)
        {
            InvalidateDurationPerStation();
            TimeSpan?result = _durationPerStation.GetStationTime(station);

            if (result == null)
            {
                InvalidateDurationPerStation(true);
                result = _durationPerStation.GetStationTime(station);
            }
            return(result);
        }
Esempio n. 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);
             }
         }
     }
 }