예제 #1
0
 public void GetOrder(String factoryType)
 {
     if (factoryType.Equals("IceCream", StringComparison.InvariantCultureIgnoreCase))
     {
         IceCreamFactory iceFactory = new IceCreamFactory();
         icecream = iceFactory.MakeIceCream(iceCreamType);
         icecream = Decorate(decoratorList);
     }
     else if (factoryType.Equals("Beverage", StringComparison.InvariantCultureIgnoreCase))
     {
         BeverageFactory drinkFactory = new BeverageFactory();
         beverage = drinkFactory.MakeBeverage(beverageType);
     }
 }
예제 #2
0
 public AbstractIceCream Decorate(String[] decoratorList)
 {
     for (int i = 0; i < decoratorList.Length; i++)
     {
         String decorator = (String)decoratorList[i];
         if (decorator.Equals("Caramel Syrup"))
         {
             icecream = new CaramelSyrupDecorator(icecream);
         }
         else if (decorator.Equals("Kiwi Syrup"))
         {
             icecream = new KiwiSyrupDecorator(icecream);
         }
         else if (decorator.Equals("Sprinkles"))
         {
             icecream = new SprinklesDecorator(icecream);
         }
     }
     return(icecream);
 }