Example #1
0
 /// <summary>
 /// 获取车站在停站序列中的顺序号,不存在为-1
 /// </summary>
 /// <param name="s">输入车站</param>
 /// <returns></returns>
 public int IndexofStation(string s)
 {
     if (StaList.Exists(k => k.StationName == s))
     {
         return(StaList.FindIndex(i => i.StationName == s));
     }
     else
     {
         return(-1);
     }
 }
Example #2
0
 /// <summary>
 /// 获取从o站到d站的旅行时间
 /// </summary>
 /// <param name="o">出发车站</param>
 /// <param name="d">到达车站</param>
 /// <returns>时间段</returns>
 public TimeSpan TravelTime(string o, string d)
 {
     if (PassStation(o) && PassStation(d))
     {
         TimeSpan ts = StaList.Find(i => i.StationName == d).ArrTime - StaList.Find(i => i.StationName == o).DepTime;
         if (ts.TotalMinutes > 0)
         {
             return(ts);
         }
     }
     return(TimeSpan.MaxValue);
 }
Example #3
0
 /// <summary>
 /// 离开s站的时间
 /// </summary>
 /// <param name="s">输入车站</param>
 /// <returns></returns>
 public DateTime getDepTime(string s)
 {
     return(StaList.Find(i => i.StationName == s).DepTime);
 }