Пример #1
0
 //constructs an object using the builder interface
 public void Construct(PizzaBuilder pizzaBuilder)
 {
     pizzaBuilder.buildDough();
     pizzaBuilder.buildCrustType();
     pizzaBuilder.buildSauce();
     pizzaBuilder.buildToppings();
 }
 //This is the director participant in the builder pattern
 public void AssemblePizza(PizzaBuilder pizzaBuilder)
 {
     pizzaBuilder.AddPizzaBase();
     pizzaBuilder.AddSauces();
     pizzaBuilder.AddCheese();
     pizzaBuilder.AddToppings();
     pizzaBuilder.BakingTime();
 }
Пример #3
0
        static void Main(string[] args)
        {
            //Lets clean the Code a little bit
            var PizzaBuilder = new PizzaBuilder(Enums.PizzaType.Meat);

            PizzaBuilder.ExtraCheese(true)
            .ExtraIngredient(Enums.ExtraIngredient.Meat)
            .PizzaCrust(Enums.PizzaCrust.Normal);

            var pizza = PizzaBuilder.Build();

            //Modifing the Prop will Throw error so it's now only accessable from Builder For full Control
            //pizza.PizzaCrust = Enums.PizzaCrust.Normal;

            Console.WriteLine(pizza);
        }
Пример #4
0
 public void DoIt(PizzaBuilder vBuilder)
 {
     vBuilder.MakeSouce();
     vBuilder.MakeDough();
 }
Пример #5
0
 public void SetPizzaBuilder(PizzaBuilder apizzaBuilder)
 {
     _pizzaBuilder = apizzaBuilder;
 }
Пример #6
0
 public void RecepcionarProximaPizza(PizzaBuilder pizzaBuilder)//Metodo que permite al usuario recepcionar la pizza que desea,
 //implementando la clase PizzaBuilder que es el constructor.
 {
     _pizzaBuilder = pizzaBuilder;
 }
Пример #7
0
 public Pizza CocinarPizza(PizzaBuilder pizzaBuilder) //se le incrementa el constructor
 {
     RecepcionarProximaPizza(pizzaBuilder);           //Métodos a desarrollar paso a paso
     CocinarPizzaPasoAPaso();                         //Métodos a desarrollar paso a paso
     return(PizzaPreparada);                          //retornar
 }