Beispiel #1
0
        private List <VariationItem> Combine(CombinationGenerator cg, List <VariationItem> viList1, List <VariationItem> viList2)
        {
            List <VariationItem> vList = new List <VariationItem>();

            foreach (VariationItem v1 in viList1)
            {
                foreach (VariationItem v2 in viList2)
                {
                    VariationItemGroup vi = new VariationItemGroup();
                    vi.Creator = typeof(CombinationGenerator).Name;
                    vi.Merge(this);

                    vi.Merge(v1);
                    vi.Children.Add(v1);

                    vi.Merge(v2);
                    vi.Children.Add(v2);

                    if (!cg.FilterVariationItem(vi))
                    {
                        vList.Add(vi);
                    }
                }
            }

            return(vList);
        }
Beispiel #2
0
        ///<summary>
        ///</summary>
        public override List <VariationItem> Generate()
        {
            List <List <VariationItem> > variationListList = base.GenerateIVGChildrenSequential();

            if (CombinerDegree == CombinationDegree.Tuple && this.Dependencies.Count > 2)
            {
                bool pictFound = true;
                if (!File.Exists("pict.exe"))
                {
                    // HACK FOR VS Deployment.
                    if (File.Exists(@"Data\pict.exe"))
                    {
                        File.Copy(@"Data\pict.exe", "pict.exe", true);
                    }
                    if (File.Exists(@"Common\pict.exe"))
                    {
                        File.Copy(@"Common\pict.exe", "pict.exe", true);
                    }
                    else
                    {
                        pictFound = false;
                    }
                }

                if (!pictFound)
                {
                    throw new InvalidOperationException("The file pict.exe is not found in the current directory. " + Directory.GetCurrentDirectory());
                }

                int countVariationList = variationListList.Count;

                object o = typeof(ObjectArrayGenerator).InvokeMember("GeneratePairwiseObjectArrays", BindingFlags.InvokeMethod | BindingFlags.Static | BindingFlags.Public,
                                                                     null, typeof(ObjectArrayGenerator), variationListList.ToArray());

                IObjectArrayCollection oCollection = (IObjectArrayCollection)o;

                List <VariationItem> list = new List <VariationItem>();

                foreach (object[] x in oCollection)
                {
                    VariationItemGroup vGroup = new VariationItemGroup();
                    vGroup.Creator = typeof(CombinationGenerator).Name;
                    vGroup.Merge(this);

                    for (int i = 0; i < countVariationList; i++)
                    {
                        VariationItem item = (VariationItem)x[i];
                        if (!FilterVariationItem(item))
                        {
                            vGroup.Merge(item);
                            vGroup.Children.Add(item);
                        }
                    }

                    list.Add(vGroup);
                }

                return(list);
            }
            else
            {
                if (variationListList.Count == 1)
                {
                    return(variationListList[0]);
                }

                if (variationListList.Count > 1)
                {
                    List <VariationItem> variationList = variationListList[0];

                    for (int i = 1; i < variationListList.Count; i++)
                    {
                        variationList = Combine(this, variationList, variationListList[i]);
                    }

                    return(variationList);
                }
            }

            return(new List <VariationItem>());
        }