public busLine(int bN, BusLineStation fS, BusLineStation lS) { busNumber = bN; firstStation = fS; lastStation = lS; myStations.Add(fS); myStations.Add(lS); }
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)))); }
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); }
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); }
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(); }
public bool chek(BusLineStation bls) { return(myStations.Contains(bls)); }
public void add(BusLineStation bls, int index) { myStations.Insert(index, bls); }