public virtual void Dispense(PillContainer container, Ingredient ingredient) { if (ingredient.Type != IngredientType) throw new InvalidOperationException("Incorrect ingredient requested"); if (Amount < ingredient.Amount) throw new InvalidOperationException($"Insufficient amount available of ingredient {ingredient.Type}"); Amount -= ingredient.Amount; container.AddIngredient(ingredient); }
public virtual void Dispense(PillContainer container, Ingredient ingredient) { if (ingredient.Type != IngredientType) { throw new InvalidOperationException("Incorrect ingredient requested"); } if (Amount < ingredient.Amount) { throw new InvalidOperationException($"Insufficient amount available of ingredient {ingredient.Type}"); } Amount -= ingredient.Amount; container.AddIngredient(ingredient); }
/// <summary> /// Notifies the recipe that production of the given /// <paramref name="container" /> failed. /// </summary> public void DropContainer(PillContainer container) { _producedAmount--; RemoveContainer(container); }
/// <summary> /// Notifies the recipe that the given <paramref name="container" /> was /// completely processed and has left the production system. /// </summary> public void RemoveContainer(PillContainer container) { _activeContainers.Remove(container); }
/// <summary> /// Adds a <paramref name="container" /> to the recipe's active containers. /// This is called when processing of the container starts. /// </summary> public void AddContainer(PillContainer container) { _producedAmount++; _activeContainers.Add(container); }
/// <summary> /// Notifies the recipe that the given <paramref name="container" /> was /// completely processed and has left the production system. /// </summary> public void RemoveContainer(PillContainer container) { _activeContainers.Remove(container); }
/// <summary> /// Adds a <paramref name="container" /> to the recipe's active containers. /// This is called when processing of the container starts. /// </summary> public void AddContainer(PillContainer container) { _producedAmount++; _activeContainers.Add(container); }
/// <summary> /// Notifies the recipe that production of the given /// <paramref name="container" /> failed. /// </summary> public void DropContainer(PillContainer container) { _producedAmount--; RemoveContainer(container); }