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; } }
internal PairwiseComparisonTerm(PairwiseComparison comparison, PairwiseParameter left, PairwiseParameter rightParam, PairwiseValue rightVal) : base(left) { if (rightVal == null && rightParam == null) { throw new ArgumentException("Can't have both val and param == null!"); } if (rightVal != null && rightParam != null) { throw new ArgumentException("Can't have both val and param non-null!"); } if (left == rightParam) { throw new ArgumentException("Can't have the same two parameters in the same comparison"); } this.rel = comparison; this.rhsValue = rightVal; this.rhsParameter = rightParam; if (rightVal != null && !this.Parameter.IsCompatibleWith(rightVal)) { throw new ArgumentException(string.Format("Mismatched types: {0} != {1}", left.PairwiseValueType, rightVal.PairwiseValueType)); } if (rightParam != null && !this.Parameter.IsCompatibleWith(rightParam)) { throw new ArgumentException(string.Format("Mismatched types: {0} != {1}", left.PairwiseValueType, rightParam.PairwiseValueType)); } if (!this.Parameter.IsCompatibleWith(rel)) { throw new NotSupportedException("Not supported: " + rel + " on " + this.Parameter + "; might be possible, though!"); } }
public PairwiseValue this[PairwiseParameter parameter] { get { return(this[parameter.Name]); } }
public void Insert(int index, PairwiseParameter parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } InnerList.Insert(index, parameter); }
public int IndexOf(PairwiseParameter parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } return(InnerList.IndexOf(parameter)); }
public bool Contains(PairwiseParameter parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } return(InnerList.Contains(parameter)); }
public void Remove(PairwiseParameter parameter) { if (parameter == null) { throw new ArgumentNullException("parameter"); } InnerList.Remove(parameter); }
protected override void OnValidate(object value) { base.OnValidate(value); PairwiseParameter parameter = value as PairwiseParameter; if (parameter == null) { throw new ArgumentException("PairwiseParameter"); } }
public PairwiseLikeTerm(PairwiseParameter parameter, string wildcardPattern) : base(parameter) { if (wildcardPattern == null) { throw new ArgumentNullException("wildcardPattern"); } // NOTE: theoretically, you could use "Like" with enums, but that fails when flags are involved if (parameter.PairwiseValueType != PairwiseValueType.String) { throw new ArgumentOutOfRangeException("parameter", parameter.PairwiseValueType, "Non-string value type given to Like operator"); } this.wildcardPattern = wildcardPattern; }
string GetParameterLine(PairwiseParameter p) { StringBuilder sb = new StringBuilder(128); foreach (PairwiseValue o in p.Values) { if (sb.Length != 0) { sb.Append(context.Settings.ValueDelimiter); } sb.Append(context.LookupValuesAndAliases(o)); } return(string.Format("{0}{1}: {2}", GetComment(p), context.LookupName(p), sb)); }
public PairwiseParameterConstraint(PairwiseParameter first, PairwiseComparison op, PairwiseParameter second) : base(first) { this.op = op; this.second = second; // only allow between the same strong-ish-types if (!this.First.IsCompatibleWith(second)) { throw new ArgumentException(string.Format("{0} != {1}", this.First.PairwiseValueType, this.second.PairwiseValueType)); } bool isrelative = !(op == PairwiseComparison.Equal || op == PairwiseComparison.NotEqual); PairwiseValueType t = this.First.PairwiseValueType; if (isrelative) { if (t == PairwiseValueType.Enum || t == PairwiseValueType.ComplexObject) { throw new NotSupportedException("Not supported: " + op + " on " + t + "; might be possible, though!"); } } }
public PairwiseLessThanOrEqualTerm LessThanOrEqual(PairwiseParameter parameter) { return(new PairwiseLessThanOrEqualTerm(this, parameter)); }
public PairwiseNotEqualTerm NotEqual(PairwiseParameter parameter) { return(new PairwiseNotEqualTerm(this, parameter)); }
public PairwiseGreaterThanOrEqualTerm GreaterThanOrEqual(PairwiseParameter parameter) { return(new PairwiseGreaterThanOrEqualTerm(this, parameter)); }
internal bool IsCompatibleWith(PairwiseParameter parameter) { return(this.PairwiseValueType == parameter.PairwiseValueType); }
public void Add(PairwiseParameter first, params PairwiseParameter[] others) { this.parameters.Add(first, others); }
public PairwiseEqualTerm Equal(PairwiseParameter parameter) { // this constructor throws if not correct return(new PairwiseEqualTerm(this, parameter)); }
public string LookupName(PairwiseParameter parameter) { return(parameter.Name); }
public void Add(PairwiseParameter parameter) { this.parameters.Add(parameter); }
public PairwiseNotEqualTerm(PairwiseParameter parameter, PairwiseParameter right) : base(PairwiseComparison.NotEqual, parameter, right, null) { }
public void Add(PairwiseParameter first, params PairwiseParameter[] parameters) { this.Add(first); this.InnerList.AddRange(parameters); }
public PairwiseNotEqualTerm(PairwiseParameter parameter, PairwiseValue value) : base(PairwiseComparison.NotEqual, parameter, null, value) { }
public PairwiseGreaterThanOrEqualTerm(PairwiseParameter parameter, PairwiseParameter right) : base(PairwiseComparison.GreaterThanOrEqual, parameter, right, null) { }
public PairwiseLessThanTerm(PairwiseParameter parameter, PairwiseValue value) : base(PairwiseComparison.LessThan, parameter, null, value) { }
public PairwiseInTerm(PairwiseParameter parameter, PairwiseValueCollection values) : base(parameter) { this.values = new PairwiseValueCollection(Check(values)); }
internal PairwiseTerm(PairwiseParameter parameter) { this.parameter = parameter; }
public PairwiseLessThanTerm(PairwiseParameter parameter, PairwiseParameter right) : base(PairwiseComparison.LessThan, parameter, right, null) { }
public PairwiseGreaterThanOrEqualTerm(PairwiseParameter parameter, PairwiseValue value) : base(PairwiseComparison.GreaterThanOrEqual, parameter, null, value) { }