Exemplo n.º 1
0
 def create_pizza(self, flavor: str) -> Pizza:
     if flavor == "cheese":
         return CheesePizza()
     elif flavor == "clam":
         return ClamPizza()
     elif flavor == "veggie":
         return VeggiePizza()
     elif flavor == "pepperoni":
         return PepperoniPizza()
     return UnknownPizza()
Exemplo n.º 2
0
    def create_pizza(self, type):
        pizza = None

        if type == "cheese":
            pizza = CheesePizza()
        elif type == "pepperoni":
            pizza = PepperoniPizza()
        elif type == "clam":
            pizza = ClamPizza()

        return pizza
 def createPizza(self, item):
     self.ingredientFactory = NYPizzaIngredientFactory()
     if item == "cheese":
         pizza = CheesePizza(self.ingredientFactory)
         pizza.setName("New York Style Cheese Pizza")
     elif item == "veggie":
         pizza = VeggiePizza(self.ingredientFactory)
         pizza.setName("New York Style Veggie Pizza")
     elif item == "clam":
         pizza = ClamPizza(self.ingredientFactory)
         pizza.setName("New York Style Clam Pizza")
     elif item == "pepperoni":
         pizza = PepperoniPizza(self.ingredientFactory)
         pizza.setName("New York Style Pepperoni Pizza")
     return pizza
Exemplo n.º 4
0
    def _create_pizza(self, item):
        pizza = None
        factory = ChicagoPizzaIngredientFactory()

        if item == 'cheese':
            pizza = CheesePizza(factory)
            pizza.set_name('Chicago Style Cheese Pizza')
        elif item == 'veggie':
            pizza = VeggiePizza(factory)
            pizza.set_name('Chicago Style Veggie Pizza')
        elif item == 'clam':
            pizza = ClamPizza(factory)
            pizza.set_name('Chicago Style Clam Pizza')
        elif item == 'pepperoni':
            pizza = PepperoniPizza(factory)
            pizza.set_name('Chicago Style Pepperoni Pizza')

        return pizza
Exemplo n.º 5
0
 def create_pizza(self, flavor: str) -> Pizza:
     ingredient_factory: PizzaIngredientFactory = (
         ChicagoPizzaIngredientFactory())
     pizza: Pizza = UnknownPizza()
     if flavor == "cheese":
         pizza = CheesePizza(ingredient_factory)
         pizza.set_name("Chicago Style Cheese Pizza")
     elif flavor == "veggie":
         pizza = VeggiePizza(ingredient_factory)
         pizza.set_name("Chicago Style Veggie Pizza")
     elif flavor == "clam":
         pizza = ClamPizza(ingredient_factory)
         pizza.set_name("Chicago Style Clam Pizza")
     elif flavor == "pepperoni":
         pizza = PepperoniPizza(ingredient_factory)
         pizza.set_name("Chicago Style Pepperoni Pizza")
     return pizza
Exemplo n.º 6
0
 def create_pizza(self, pizza_type):
     if pizza_type == "cheese":
         return CheesePizza(self.ingredient_factory)
     elif pizza_type == "clam":
         return ClamPizza(self.ingredient_factory)