Exemplo n.º 1
0
        /// <summary>
        /// Used to open counters for incomming flights
        /// </summary>
        internal void OpenCountersForIncommingFlights(FlightSchedule flightSchedule)
        {
            // Find flights there are ready for check in
            List <Flight> flights = flightSchedule.Flights.FindAll(f => f.IsReadyForCheckIn() == true);

            foreach (Flight flight in flights)
            {
                Counter counter = Counters.Where(c => c.IsOpen == false).FirstOrDefault();

                // If flight already has a counter, skip...
                if (Counters.Any(c => c.Flight == flight))
                {
                    continue;
                }

                // If counter is available
                // Update counter flight screen and open counter
                if (counter != null)
                {
                    counter.SetTargetedFlight(flight);
                    counter.Open();
                    continue;
                }
            }
        }
        public Simulator(int counterAmount, int terminalAmount, int conveyorBeltLength)
        {
            Time            = new SimulationTime();
            Time.TimeUpdate = OnTimeUpdate;

            CheckinArea    = new CheckinArea(counterAmount);
            TerminalsArea  = new TerminalsArea(terminalAmount);
            SortingMachine = new SortingMachine(Time, conveyorBeltLength, CheckinArea, TerminalsArea);
            FlightSchedule = new FlightSchedule(Time);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Used to open terminas for incomming flights
        /// </summary>
        internal void OpenTerminalsForIncommingFlights(FlightSchedule flightSchedule)
        {
            // Gets all the flights there is on the way
            List <Flight> flights = flightSchedule.Flights.FindAll(f => f.Status == FlightStatus.OnTheWay);

            foreach (Flight flight in flights)
            {
                if (!flight.IsAtTerminal)
                {
                    Terminal terminal = Terminals.FirstOrDefault(t => !t.IsFlightReservedToTerminal);

                    if (terminal != null)
                    {
                        flight.MoveToTerminal(terminal);
                        terminal.ReserveTerminalToFlight(flight);
                    }
                }
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Used to add flight to flight schedule
 /// </summary>
 /// <param name="flight"></param>
 public void AddFlight(Flight flight)
 {
     FlightSchedule.AddFlight(flight);
 }