예제 #1
0
 public Kitchen(Dictionary<String, Recipe> recipes, Recipe mainrecipe,
     Container[] mbowls, Container[] bdishes)
 {
     this.recipes = recipes;
     //start with at least 1 mixing bowl.
     int maxbowl = 0, maxdish = -1;
     recipe = mainrecipe;
     foreach (Method m in recipe.getMethods())
     {
         if (m.bakingdish != null && m.bakingdish > maxdish)
             maxdish = m.bakingdish;
         if (m.mixingbowl != null && m.mixingbowl > maxbowl)
             maxbowl = m.mixingbowl;
     }
     mixingbowls = new Container[mbowls == null ? maxbowl + 1 : Math.Max(maxbowl + 1, mbowls.Length)];
     bakingdishes = new Container[bdishes == null ? maxdish + 1 : Math.Max(maxdish + 1, bdishes.Length)];
     for (int i = 0; i < mixingbowls.Length; i++)
         mixingbowls[i] = new Container();
     for (int i = 0; i < bakingdishes.Length; i++)
         bakingdishes[i] = new Container();
     if (mbowls != null)
     {
         for (int i = 0; i < mbowls.Length; i++)
         {
             mixingbowls[i] = new Container(mbowls[i]);
         }
     }
     if (bdishes != null)
     {
         for (int i = 0; i < bdishes.Length; i++)
         {
             bakingdishes[i] = new Container(bdishes[i]);
         }
     }
 }
예제 #2
0
 public void combine(Container c)
 {
     contents.AddRange(c.contents);
 }
예제 #3
0
 public Container(Container container)
 {
     contents = new List<Component>(container.contents);
 }