예제 #1
0
        /// <summary>
        /// Used to check luggage in at terminal
        /// </summary>
        internal void Checkin(Luggage luggage)
        {
            Counter counter = Counters.FirstOrDefault(c => c.Id == luggage.CounterId);

            counter.Checkin(luggage);
            luggage.Reservation.IsCheckedIn = true;
        }
예제 #2
0
 /// <summary>
 /// Used to check luggage in
 /// </summary>
 internal void Checkin(Luggage luggage)
 {
     if (Luggage == null)
     {
         Luggage = luggage;
     }
     else
     {
         throw new Exception("There is already luggage on counter!");
     }
 }
예제 #3
0
        /// <summary>
        /// Used to update the counter to sorter process
        /// </summary>
        private void UpdateCounterToSorterProcess()
        {
            if (ConveyorBelt.IsSpace())
            {
                // Gets all counters there has luggage to go on the conveyor belt
                List <Counter> counters = this.counters.Where(c => c.IsLuggageReady()).ToList();

                if (counters.Count != 0)
                {
                    // Finds random counter
                    Counter counter = counters[rng.Next(0, counters.Count)];

                    // Gets luggage
                    Luggage luggage = counter.GetLuggageFromCounter();

                    // Push the luggage to the conveyor belt
                    ConveyorBelt.Push(luggage);

                    ProcessInfo?.Invoke($"Luggage owned by {luggage.Reservation.Passenger.FirstName} is now on the conveyor belt to terminal {luggage.TerminalId}");
                }
            }
        }
예제 #4
0
        /// <summary>
        /// Used to update the sorter to terminal process
        /// </summary>
        private void UpdateSorterToTerminalProcess()
        {
            // Check if next pull is not empty
            if (!ConveyorBelt.IsPullEmpty())
            {
                // Pulls luggage from last index in the buffer
                Luggage luggage = ConveyorBelt.Pull();

                // Finds the terminal where the luggage should goto
                Terminal terminal = terminals.FirstOrDefault(t => t.Id == luggage.TerminalId);

                if (terminal != null)
                {
                    terminal.AddLuggage(luggage); // Adds luggage to terminal storage
                }

                ProcessInfo?.Invoke($"Luggage owned by {luggage.Reservation.Passenger.FirstName} is now in terminal {terminal.Id}");
            }
            else
            {
                ConveyorBelt.MoveForward();
            }
        }
예제 #5
0
 /// <summary>
 /// Used to add luggage to terminal storage
 /// </summary>
 internal void AddLuggage(Luggage luggage)
 {
     Luggages.Enqueue(luggage);
 }