コード例 #1
0
        public int Move(int rank)
        {
            BusRoute currentRoute = BusSystem.GetBusRoute(RouteId);

            int currentStopId    = currentRoute.GetBusStopInfoByBusLocation(Location).Item2;
            var resut            = currentRoute.GetBusStopInfoByBusLocation(Location + 1);
            int nextStopId       = resut.Item2;
            int nextStopLocation = resut.Item1;

            BusStop currentStop = BusSystem.GetBusStop(currentStopId);
            BusStop nextStop    = BusSystem.GetBusStop(nextStopId);

            //Bus left current stop
            // int offBus = BusRider.GetRiderOffBus(nextStopId, rank);
            // int onBus = BusRider.GetRiderOnBus(nextStopId, rank);

            //UpdateBusPassenger(offBus, onBus);
            UpdateBusLocation(nextStopLocation);
            //nextStop.UpdateStopRidersByBus(onBus, offBus);

            int time = BusStop.CalculateTimeWithSpeed(currentStop, nextStop, Speed);

            Console.WriteLine("b:{0}->s:{1}@{2}//p:{3}/f:{4}", Id, nextStopId, time + rank, 0, 0);
            return(time);
        }
コード例 #2
0
ファイル: SimEvent.cs プロジェクト: TDnothing/MTS
        public void ExecuteEvent()
        {
            Bus currentBus = BusSystem.GetBus(_objectId);
            //Console.WriteLine("rank: {0}: move_bus ID: {1}", _rank, currentBus.Id);
            int      NextRank  = currentBus.Move(_rank);
            SimEvent nextEvent = new SimEvent(NextRank + _rank, "move bus", currentBus.Id);

            SimEventQueue.AddSimEventsQueue(nextEvent);
        }
コード例 #3
0
        public void Readfile(StreamReader file)
        {
            file.DiscardBufferedData();
            file.BaseStream.Seek(0, System.IO.SeekOrigin.Begin);
            int    counter = 0;
            string line;

            while ((line = file.ReadLine()) != null)
            {
                List <string> result = line.Split(',').ToList();
                BusSystem.CreateObject(result);
                System.Console.WriteLine(line);
                counter++;
            }
        }
コード例 #4
0
 public void MoveNextBusButtonClick()
 {
     BusSystem.MoveNextBus();
 }