Esempio n. 1
0
 public int CompareTo(StopList other)
 {
     if (Route != other.Route)
     {
         return(Route.GetHashCode() - other.Route.GetHashCode());
     }
     if (Count != other.Count)
     {
         return(Count - other.Count);
     }
     for (int i = 0; i < Count; i++)
     {
         if (this[i].Item1 != other[i].Item1)
         {
             return(this[i].Item1.GetHashCode() - other[i].Item1.GetHashCode());
         }
     }
     //for (int i = 0; i < Count; i++)
     //    if (this[i].Item2 != other[i].Item2)
     //        throw new Exception("Wrong stop_headsign field (ambigousity)");
     return(0);
 }
Esempio n. 2
0
            public void CreateLists(List <Trip> trips)
            {
                var stopList = new StopList(this.Select(x => Tuple.Create(x.Item1, x.Item3)), Route);

                if (!StopLists.ContainsKey(stopList))
                {
                    StopLists.Add(stopList, stopList);
                }
                StopList = StopLists[stopList];

                var timeList = new TimeList(this.Select(x => x.Item2), StopList);

                if (!TimeLists.ContainsKey(timeList))
                {
                    TimeLists.Add(timeList, timeList);
                }
                else
                {
                    throw new InvalidOperationException();
                }
                TimeList       = TimeLists[timeList];
                TimeList.Trips = trips;
            }
Esempio n. 3
0
        public void getStopID(string stop_code)
        {
            //var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("stop_list.txt");
            StopList stopList = new StopList();

            var allstops = stopList.AllStops;

            foreach (var stop in allstops)
            {
                if (stop_code == stop.stop_code)
                {
                    BusStopInstance.stop_id = stop.stop_id;
                    BusStopInstance.stop_lat = stop.stop_lat.ToString();
                    BusStopInstance.stop_lon = stop.stop_lon.ToString();
                }
            }
        }
Esempio n. 4
0
 public bool    isStopWord(string str)
 {
     return(StopList.Contains(str));
 }
Esempio n. 5
0
        public void TestIsNotStopWord()
        {
            StopList stopList = new StopList();

            Assert.AreEqual(false, stopList.IsStopWord("rock"));
        }
Esempio n. 6
0
        public void TestIsStopWord()
        {
            StopList stopList = new StopList();

            Assert.AreEqual(true, stopList.IsStopWord("everyone"));
        }
Esempio n. 7
0
 public TimeList(IEnumerable <TimeSpan> times, StopList base_) : base(times)
 {
     this.Base = base_;
 }