示例#1
0
        public PairwiseObjectArrayEnumerator(PairwiseSettings settings, PairwiseModel model, IList[] lists)
        {
            this.settings   = settings;
            this.model      = model;
            this.tupleLen   = model.Parameters.Count;
            this.lists      = (IList[])lists.Clone();
            current         = -1;
            rebuildRequired = true;
            allTuples       = null;

            // readonly cur
            this.cur = null;
            this.Reset();
        }
        public PairwiseObjectArrayCollection(int order, params IEnumerable[] enumerables)
        {
            this.settings = new PairwiseSettings(order, true);
            this.lists = new IList[enumerables.Length];

            // build the big lookup table
            this.model = new PairwiseModel();
            for (int i = 0; i < enumerables.Length; ++i)
            {
                // the enumerator from here is disposed (if necessary) in the below foreach loop
                IEnumerable origList = enumerables[i];
                bool copy;
                IList temp = origList as IList;

                if (temp != null)
                {
                    copy = false;
                }
                else
                {
                    temp = new ArrayList();
                    copy = true;
                }

                int index = 0;
                PairwiseParameter param = new PairwiseParameter("P" + i.ToString(PictConstants.Culture));

                foreach (object item in origList)
                {
                    if (copy)
                    {
                        temp.Add(item);
                    }

                    param.AddValue(index);
                    ++index;
                }

                this.lists[i] = temp;
                model.Parameters.Add(param);
            }
        }