Exemplo n.º 1
0
        /// <summary>
        /// Merges the content of the given feed with this feed by adding or replacing entities.
        /// </summary>
        public static void Merge(this IGTFSFeed thisFeed, IGTFSFeed feed)
        {
            var feedInfo = feed.GetFeedInfo();

            if (feedInfo != null)
            {
                thisFeed.SetFeedInfo(feedInfo);
            }
            foreach (var entity in feed.Agencies)
            {
                thisFeed.Agencies.AddOrReplace(entity, x => x.Id);
            }
            foreach (var entity in feed.CalendarDates)
            {
                thisFeed.CalendarDates.AddOrReplace(entity);
            }
            foreach (var entity in feed.Calendars)
            {
                thisFeed.Calendars.AddOrReplace(entity);
            }
            foreach (var entity in feed.FareAttributes)
            {
                thisFeed.FareAttributes.AddOrReplace(entity);
            }
            foreach (var entity in feed.FareRules)
            {
                thisFeed.FareRules.AddOrReplace(entity, x => x.FareId);
            }
            foreach (var entity in feed.Frequencies)
            {
                thisFeed.Frequencies.AddOrReplace(entity);
            }
            foreach (var entity in feed.Routes)
            {
                thisFeed.Routes.AddOrReplace(entity, x => x.Id);
            }
            foreach (var entity in feed.Shapes)
            {
                thisFeed.Shapes.AddOrReplace(entity);
            }
            foreach (var entity in feed.Stops)
            {
                thisFeed.Stops.AddOrReplace(entity, x => x.Id);
            }
            foreach (var entity in feed.StopTimes)
            {
                thisFeed.StopTimes.AddOrReplace(entity);
            }
            foreach (var entity in feed.Transfers)
            {
                thisFeed.Transfers.AddOrReplace(entity);
            }
            foreach (var entity in feed.Trips)
            {
                thisFeed.Trips.AddOrReplace(entity, x => x.Id);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Copies this feed to the given feed.
        /// </summary>
        public static void CopyTo(this IGTFSFeed thisFeed, IGTFSFeed feed)
        {
            var feedInfo = thisFeed.GetFeedInfo();

            if (feedInfo != null)
            {
                feed.SetFeedInfo(feedInfo);
            }
            foreach (var entity in thisFeed.Agencies)
            {
                feed.Agencies.Add(entity);
            }
            foreach (var entity in thisFeed.CalendarDates)
            {
                feed.CalendarDates.Add(entity);
            }
            foreach (var entity in thisFeed.Calendars)
            {
                feed.Calendars.Add(entity);
            }
            foreach (var entity in thisFeed.FareAttributes)
            {
                feed.FareAttributes.Add(entity);
            }
            foreach (var entity in thisFeed.FareRules)
            {
                feed.FareRules.Add(entity);
            }
            foreach (var entity in thisFeed.Frequencies)
            {
                feed.Frequencies.Add(entity);
            }
            foreach (var entity in thisFeed.Routes)
            {
                feed.Routes.Add(entity);
            }
            foreach (var entity in thisFeed.Shapes)
            {
                feed.Shapes.Add(entity);
            }
            foreach (var entity in thisFeed.Stops)
            {
                feed.Stops.Add(entity);
            }
            foreach (var entity in thisFeed.StopTimes)
            {
                feed.StopTimes.Add(entity);
            }
            foreach (var entity in thisFeed.Transfers)
            {
                feed.Transfers.Add(entity);
            }
            foreach (var entity in thisFeed.Trips)
            {
                feed.Trips.Add(entity);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Copies this feed to the given feed.
 /// </summary>
 /// <param name="thisFeed"></param>
 /// <param name="feed"></param>
 public static void CopyTo(this IGTFSFeed thisFeed, IGTFSFeed feed)
 {
     var feedInfo = thisFeed.GetFeedInfo();
     if(feedInfo != null)
     {
         feed.SetFeedInfo(feedInfo);
     }
     foreach(var entity in thisFeed.Agencies)
     {
         feed.Agencies.Add(entity);
     }
     foreach (var entity in thisFeed.CalendarDates)
     {
         feed.CalendarDates.Add(entity);
     }
     foreach (var entity in thisFeed.Calendars)
     {
         feed.Calendars.Add(entity);
     }
     foreach (var entity in thisFeed.FareAttributes)
     {
         feed.FareAttributes.Add(entity);
     }
     foreach (var entity in thisFeed.FareRules)
     {
         feed.FareRules.Add(entity);
     }
     foreach (var entity in thisFeed.Frequencies)
     {
         feed.Frequencies.Add(entity);
     }
     foreach (var entity in thisFeed.Routes)
     {
         feed.Routes.Add(entity);
     }
     foreach (var entity in thisFeed.Shapes)
     {
         feed.Shapes.Add(entity);
     }
     foreach (var entity in thisFeed.Stops)
     {
         feed.Stops.Add(entity);
     }
     foreach (var entity in thisFeed.StopTimes)
     {
         feed.StopTimes.Add(entity);
     }
     foreach (var entity in thisFeed.Transfers)
     {
         feed.Transfers.Add(entity);
     }
     foreach (var entity in thisFeed.Trips)
     {
         feed.Trips.Add(entity);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Copies this feed to the given feed.
        /// </summary>
        public static void CopyTo(this IGTFSFeed thisFeed, IGTFSFeed feed)
        {
            var feedInfo = thisFeed.GetFeedInfo();

            if (feedInfo != null)
            {
                feed.SetFeedInfo(feedInfo);
            }

            feed.Agencies.AddRange(thisFeed.Agencies);
            feed.CalendarDates.AddRange(thisFeed.CalendarDates);
            feed.Calendars.AddRange(thisFeed.Calendars);
            feed.FareAttributes.AddRange(thisFeed.FareAttributes);
            feed.FareRules.AddRange(thisFeed.FareRules);
            feed.Frequencies.AddRange(thisFeed.Frequencies);
            feed.Routes.AddRange(thisFeed.Routes);
            feed.Shapes.AddRange(thisFeed.Shapes);
            feed.Stops.AddRange(thisFeed.Stops);
            feed.StopTimes.AddRange(thisFeed.StopTimes);
            feed.Transfers.AddRange(thisFeed.Transfers);
            feed.Trips.AddRange(thisFeed.Trips);
            feed.Levels.AddRange(thisFeed.Levels);
            feed.Pathways.AddRange(thisFeed.Pathways);
        }