示例#1
0
        protected override PizzaBase CreatePizza(PizzaType type)
        {
            PizzaBase pizza = null;
            IPizzaIngredientFactory factory = new NYPizzaIngredientFactory();

            switch (type)
            {
            case PizzaType.Cheese:
            {
                pizza = new CheesePizza(factory);
                pizza.SetName("New York Style Cheese Pizza");
                break;
            }

            case PizzaType.Pepperoni:
            {
                pizza = new PepperoniPizza(factory);
                pizza.SetName("New York Style Pepperoni Pizza");
                break;
            }

            case PizzaType.Special:
            {
                pizza = new CurrentSpecialPizza(factory);
                pizza.SetName("New York Pizza Special!");
                break;
            }

            default:
                throw new ArgumentException("Invalid Pizza type given");
            }

            return(pizza);
        }
        protected override Pizza CreatePizza(string item)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

            if (item.Equals(PizzaIngredientFactoryConstants.CHEESE_PIZZA))
            {
                pizza = new CheesePizza(ingredientFactory);
                pizza.SetName("New York Style Cheese Pizza");
            }
            else if (item.Equals(PizzaIngredientFactoryConstants.VEGGIE_PIZZA))
            {
                pizza = new VeggiePizza(ingredientFactory);
                pizza.SetName("New York Style Veggie Pizza");
            }
            else if (item.Equals(PizzaIngredientFactoryConstants.CLAM_PIZZA))
            {
                pizza = new ClamPizza(ingredientFactory);
                pizza.SetName("New York Style Clam Pizza");
            }
            else if (item.Equals(PizzaIngredientFactoryConstants.PEPPERONI_PIZZA))
            {
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.SetName("New York Style Pepperoni Pizza");
            }
            return(pizza);
        }
示例#3
0
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new NewYorkIngredientFactory();

            if (type.Equals("Cheese"))
            {
                pizza = new CheesePizza(ingredientFactory);
                pizza.SetName("New York Style Cheese");
            }
            else if (type.Equals("Greek"))
            {
                pizza = new GreekPizza(ingredientFactory);
                pizza.SetName("New York Style Greek");
            }
            else if (type.Equals("Pepperoni"))
            {
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.SetName("New York Style Cheese Pepperoni");
            }
            else if (type.Equals("Veggie"))
            {
                pizza = new VeggiePizza(ingredientFactory);
                pizza.SetName("New York Style Veggie");
            }
            else if (type.Equals("Clam"))
            {
                pizza = new ClamPizza(ingredientFactory);
                pizza.SetName("New York Style Clam");
            }

            return(pizza);
        }
        public override Pizza CreatePizza(string pizzaType)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new NYPizzaIngredientFactory();

            switch (pizzaType)
            {
            case "cheese":
                pizza = new CheesePizza(ingredientFactory);
                pizza.SetName("New York Style Cheese Pizza");
                break;

            case "veggie":
                pizza = new VeggiePizza(ingredientFactory);
                pizza.SetName("New York Style Veggie Pizza");
                break;

            case "clam":
                pizza = new ClamPizza(ingredientFactory);
                pizza.SetName("New York Style Clam Pizza");
                break;

            case "pepperoni":
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.SetName("New York Style Pepperoni Pizza");
                break;
            }

            return(pizza);
        }
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza;
            var   ingredientFactory = new ChicagoPizzaIngredientFactory();

            switch (type)
            {
            case "cheese":
                pizza = new CheesePizza(ingredientFactory);
                pizza.SetName("New York Style Cheese Pizza");
                break;

            case "clam":
                pizza = new ClamPizza(ingredientFactory);
                pizza.SetName("New York Style Clam Pizza");
                break;

            case "veggie":
                pizza = new VeggiePizza(ingredientFactory);
                pizza.SetName("New York Style Veggie Pizza");
                break;

            case "pepperoni":
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.SetName("New York Style Pepperoni Pizza");
                break;

            default:
                pizza = null;
                break;
            }

            return(pizza);
        }
示例#6
0
        public override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory pizzaIngredientFactory = new NYPizzaIngredientFactory();

            if (type == "cheese")
            {
                pizza = new CheesePizza(pizzaIngredientFactory);
                pizza.SetName("New York Style Cheese Pizza");
            }
            else if (type == "clam")
            {
                pizza = new ClamPizza(pizzaIngredientFactory);
                pizza.SetName("New York Style Clam Pizza");
            }
            else if (type == "pepperoni")
            {
                pizza = new PepperoniPizza(pizzaIngredientFactory);
                pizza.SetName("New York Style Pepperoni Pizza");
            }
            else
            {
                return(null);
            }
            return(pizza);
        }
        protected override Pizza CreatePizza(PizzaType type)
        {
            Pizza pizza;

            switch (type)
            {
            case PizzaType.Cheese:
                pizza = new CheesePizza(_ingredientFactory);
                pizza.SetName("Chicago Style Cheese Pizza");
                break;

            case PizzaType.Pepperoni:
                pizza = new PepperoniPizza(_ingredientFactory);
                pizza.SetName("Chicago Style Pepperoni Pizza");
                break;

            case PizzaType.Clam:
                pizza = new ClamPizza(_ingredientFactory);
                pizza.SetName("Chicago Style Clam Pizza");
                break;

            case PizzaType.Veggie:
                pizza = new VeggiePizza(_ingredientFactory);
                pizza.SetName("Chicago Style Veggie Pizza");
                break;

            default:
                return(null);
            }

            return(pizza);
        }
        public override Pizza CreatePizza(string pizzaType)
        {
            Pizza pizza = null;
            IPizzaIngredientFactory ingredientFactory = new ChicagoPizzaIngredientFactory();

            switch (pizzaType)
            {
            case "cheese":
                pizza = new CheesePizza(ingredientFactory);
                pizza.SetName("Chicago Style Deep Dish Cheese Pizza");
                break;

            case "veggie":
                pizza = new VeggiePizza(ingredientFactory);
                pizza.SetName("Chicago Style Deep Dish Veggie Pizza");
                break;

            case "clam":
                pizza = new ClamPizza(ingredientFactory);
                pizza.SetName("Chicago Style Deep Dish Clam Pizza");
                break;

            case "pepperoni":
                pizza = new PepperoniPizza(ingredientFactory);
                pizza.SetName("Chicago Style Deep Dish Pepperoni Pizza");
                break;
            }

            return(pizza);
        }
示例#9
0
        protected override Pizza CreatePizza(string type)
        {
            Pizza pizza = null;

            if (type.Equals("cheese"))
            {
                pizza = new CheesePizza(_pizzaIngredientFactory);
                pizza.SetName("New York style cheese pizza");
            }
            else if (type.Equals("pepperoni"))
            {
                pizza = new PepperoniPizza(_pizzaIngredientFactory);
                pizza.SetName("New York style pepperoni pizza");
            }
            else if (type.Equals("clam"))
            {
                pizza = new ClamPizza(_pizzaIngredientFactory);
                pizza.SetName("New York style clam pizza");
            }

            return(pizza);
        }