コード例 #1
0
        /*
         * Adds a client and merges the new client with an old one if necessary, then it looks for a match with that new
         * client.
         * client : The client that we add to the Airport's list
         */
        public void AddClient(Client_Normal client)
        {
            Client_Normal clientToMerge = null;

            foreach (Client_Normal clientLoop in _clients)
            {
                if (clientLoop.Destination == client.Destination)
                {
                    clientToMerge = clientLoop;
                }
            }


            if (clientToMerge != null && clientToMerge.Type == client.Type)
            {
                if (client.Type == 'P')
                {
                    _clients.Add(Client.MergePassengerClient((Client_Passenger)clientToMerge, (Client_Passenger)client));
                }
                else
                {
                    _clients.Add(Client.MergeCargoClient((Client_Cargo)clientToMerge, (Client_Cargo)client));
                }
            }
            else
            {
                _clients.Add(client);
            }
            LookForMatch(client.Type, client, null);
        }
コード例 #2
0
 /*
  * Removes the Normal Client from the Airport.
  * client : Client that needs to be removed
  */
 private void RemoveClient(Client_Normal client)
 {
     _clients.Remove(client);
 }