コード例 #1
0
 public busLine(int bN, BusLineStation fS, BusLineStation lS)
 {
     busNumber    = bN;
     firstStation = fS;
     lastStation  = lS;
     myStations.Add(fS);
     myStations.Add(lS);
 }
コード例 #2
0
        public static double distanse(busLine bL, BusLineStation source, BusLineStation target)
        {
            int index1 = bL.myStations.IndexOf(source);
            int index2 = bL.myStations.IndexOf(target);

            ////צריך לתקן ע"י שסוכמים את כל המרחקים


            return(Math.Sqrt((bL.myStations[index2].bS.Latitude - bL.myStations[index1].bS.Latitude) * (bL.myStations[index2].bS.Latitude - bL.myStations[index1].bS.Latitude) + ((bL.myStations[index2].bS.Longitude - bL.myStations[index1].bS.Longitude) * (bL.myStations[index2].bS.Longitude - bL.myStations[index1].bS.Longitude))));
        }
コード例 #3
0
        public static busLine route(busLine bL, BusLineStation source, BusLineStation target)
        {
            int     index1 = bL.myStations.IndexOf(source);
            int     index2 = bL.myStations.IndexOf(target);
            busLine newBus = new busLine(0, source, target);

            for (int i = index1; i < index2; ++i)
            {
                newBus.myStations.Add(bL.myStations[i]);
            }
            return(newBus);
        }
コード例 #4
0
        public double Time(BusLineStation source, BusLineStation target)
        {
            int    index1 = this.myStations.IndexOf(source);
            int    index2 = this.myStations.IndexOf(target);
            double count  = 0;

            for (int i = index1; i < index2; ++i)
            {
                count += this.myStations[i].time;
            }
            return(count);
        }
コード例 #5
0
        public busLine Compare(object obj, BusLineStation source, BusLineStation target)
        {
            busLine other = (busLine)obj;

            if (this.Time(source, target) > other.Time(source, target))
            {
                return(other);
            }
            else if (this.Time(source, target) <= other.Time(source, target))
            {
                return(this);
            }


            throw new NotImplementedException();
        }
コード例 #6
0
 public bool chek(BusLineStation bls)
 {
     return(myStations.Contains(bls));
 }
コード例 #7
0
 public void add(BusLineStation bls, int index)
 {
     myStations.Insert(index, bls);
 }