Supermarket.Supermarket.NotifyShelfEmpty C# (CSharp) Méthode

NotifyShelfEmpty() public méthode

Interface method. Called when a shelf runs out of the given product.
public NotifyShelfEmpty ( Shelf shelf, string product ) : void
shelf Shelf The shelf that has run out of stock of a product
product string The product that the shelf has run out of the given product
Résultat void
        public void NotifyShelfEmpty(Shelf shelf, string product)
        {
            if (directory.ContainsKey(product))
            {
                shelvesToStock.Enqueue(shelf);
                // Remove shelf from directory product->shelf listing
                directory[product].Remove(shelf);
                if (directory[product].Count == 0)
                {
                    // Remove product from directory
                    directory.Remove(product);
                }
            }
        }