Esempio n. 1
0
        private void LoadStopDemands(List <string[]> demandsData)
        {
            if (demandsData != null)
            {
                Console.WriteLine(this + "Loading Stop Demands...");
                var watch = Stopwatch.StartNew();
                foreach (var demandData in demandsData)
                {
                    var route  = Routes.Find(r => r.Id == int.Parse(demandData[0]));
                    var stop   = Stops.Find(s => s.Id == int.Parse(demandData[1]));
                    var hour   = int.Parse(demandData[2]);
                    var demand = (int)Math.Round(Convert.ToDouble(double.Parse(demandData[3])));
                    if (stop != null && route != null)
                    {
                        DemandsDataObject.AddDemand(stop.Id, route.Id, hour, demand);
                    }
                }

                watch.Stop();
                var elapsedMs = watch.ElapsedMilliseconds;
                var seconds   = elapsedMs * 0.001;
                Console.WriteLine(this.ToString() + "Stop demands were successfully loaded in " + seconds +
                                  " seconds.");
            }
        }
Esempio n. 2
0
 public TransportationNetworkDataLoader(bool urbanOnly)
 {
     _urbanOnly        = urbanOnly;
     Trips             = new List <Trip>();
     Stops             = new List <Stop>();
     Routes            = new List <Route>();
     DemandsDataObject = new DemandsDataObject();
     Load();
 }