Ejemplo n.º 1
0
        public static SimEvent GetLowestRankEvent()
        {
            SimEvent simE = Events.FirstOrDefault();

            Events.RemoveAt(0);
            return(simE);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        public static void CreateObject(List <string> command)
        {
            switch (command[0])
            {
            case "add_depot":
//                    BusStop busStop0 = new BusStop(Convert.ToInt32(command[1]), command[2],0, Convert.ToDouble(command[3]), Convert.ToDouble(command[4]));
//                    BusStops.Add(busStop0);
                break;

            case "add_bus":
                Bus bus1 = new Bus(Convert.ToInt32(command[1]), Convert.ToInt32(command[2]), Convert.ToInt32(command[3]), Convert.ToInt32(command[4]), Convert.ToInt32(command[5]),
                                   Convert.ToInt32(command[6]), Convert.ToInt32(command[7]), Convert.ToInt32(command[8]));
                Buses.Add(bus1);
                break;

            case "add_stop":
                BusStop busStop1 = new BusStop(Convert.ToInt32(command[1]), command[2], Convert.ToInt32(command[3]), Convert.ToDouble(command[4]), Convert.ToDouble(command[5]));
                BusStops.Add(busStop1);
                break;

            case "add_route":
                BusRoute busRoute1 = new BusRoute(Convert.ToInt32(command[1]), Convert.ToInt32(command[2]), command[3]);
                BusRoutes.Add(busRoute1);
                break;

            case "extend_route":
                BusRoute targetRoute = GetBusRoute(Convert.ToInt32(command[1]));
                targetRoute?.ExtendRoute(Convert.ToInt32(command[2]));
                break;

            case "add_event":
                SimEvent simEvent = new SimEvent(Convert.ToInt32(command[1]), command[2], Convert.ToInt32(command[3]));
                SimEventQueue.AddSimEventsQueue(simEvent);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
 public int GetObjectId(SimEvent e)
 {
     return(e._objectId);
 }
Ejemplo n.º 5
0
 public static void AddSimEventsQueue(SimEvent e)
 {
     Events.Add(e);
     OrderQueue();
 }