Esempio n. 1
0
        public Pizza MakePizza(string pizzaRequest)
        {
            Pizza newPizza = null;

            if (pizzaRequest == _firstPizzaName)
            {
                _firstBuilder.InitializeIngredients();
                _firstBuilder.InitializeMetricInfo();
                _firstBuilder.InitializeAdditionInfo();
                newPizza = _firstBuilder.GetPreparedPizza();
                _firstBuilder.ReInitializeBuilder();
            }
            if (pizzaRequest == _secondPizzaName)
            {
                _secondBuilder.InitializeIngredients();
                _secondBuilder.InitializeMetricInfo();
                _secondBuilder.InitializeAdditionInfo();
                newPizza = _secondBuilder.GetPreparedPizza();
                _secondBuilder.ReInitializeBuilder();
            }
            if (pizzaRequest == _thirdPizzaName)
            {
                _thirdBuilder.InitializeIngredients();
                _thirdBuilder.InitializeMetricInfo();
                _thirdBuilder.InitializeAdditionInfo();
                newPizza = _thirdBuilder.GetPreparedPizza();
                _thirdBuilder.ReInitializeBuilder();
            }
            if (newPizza != null)
            {
                return(newPizza);
            }
            return(null);
        }