Exemple #1
0
        void BuildLookupTable()
        {
            // initialize
            lookupTables = new Hashtable[this.parameters.Count];
            for (int i = 0; i < this.parameters.Count; ++i)
            {
                PairwiseParameter       pp     = this.parameters[i];
                PairwiseValueCollection values = pp.Values;
                Hashtable h = new Hashtable(values.Count);

                foreach (PairwiseValue pv in values)
                {
                    string key = LookupInputValue(pv);

                    h[key] = pv;
                    if (pv.Aliases.Count != 0)
                    {
                        foreach (PairwiseValue a in pv.Aliases)
                        {
                            h[LookupInputValue(a)] = a;
                        }
                    }
                }

                lookupTables[i] = h;
            }
        }
Exemple #2
0
 public PairwiseParameter(string name, PairwiseValueCollection values)
 {
     this.name = name;
     foreach (PairwiseValue o in values)
     {
         this.AddValue(o);
     }
 }
Exemple #3
0
        public PairwiseInTerm In(PairwiseValueCollection values)
        {
            if (values.Count == 0)
            {
                throw new ArgumentException("empty values");
            }

            return(new PairwiseInTerm(this, values));
        }
        public static PairwiseValueCollection CreateFromObjects(params object[] values)
        {
            PairwiseValueCollection coll = new PairwiseValueCollection();

            foreach (object o in values)
            {
                coll.Add(new PairwiseValue(o));
            }

            return(coll);
        }
        public static PairwiseValueCollection CreateFromEnumType(Type t)
        {
            if (!t.IsEnum)
            {
                throw new ArgumentException(t.FullName + " isn't an enum!");
            }

            PairwiseValueCollection coll = new PairwiseValueCollection();

            foreach (Enum e in Enum.GetValues(t))
            {
                coll.Add(new PairwiseValue(e));
            }

            return(coll);
        }
Exemple #6
0
        PairwiseValueCollection Check(PairwiseValueCollection coll)
        {
            if (coll == null)
            {
                throw new ArgumentNullException("collection");
            }

            if (coll.Count == 0)
            {
                throw new ArgumentException("No items in collection");
            }

            if (!this.Parameter.IsCompatibleWith(coll[0]))
            {
                throw new PairwiseException("Inconsistent value types: " + coll[0].ValueType + " != " + this.Parameter.PairwiseValueType + " (expected for " + this.Parameter.Name + ")");
            }

            return(coll);
        }
 public PairwiseValueCollection(PairwiseValueCollection c)
 {
     this.InnerList.AddRange(c.InnerList);
 }
Exemple #8
0
 public static PairwiseParameter CreateFromEnum(string name, Type enumType)
 {
     return(new PairwiseParameter(name, PairwiseValueCollection.CreateFromEnumType(enumType)));
 }
Exemple #9
0
 public PairwiseInTerm(PairwiseParameter parameter, PairwiseValueCollection values) : base(parameter)
 {
     this.values = new PairwiseValueCollection(Check(values));
 }