/// <summary> /// Returns the strict intersection of the TupleDomains. /// The resulting TupleDomain represents the set of tuples that would be valid /// in both TupleDomains. /// </summary> /// <param name="other"></param> /// <returns></returns> public TupleDomain <T> Intersect(TupleDomain <T> other) { if (this.IsNone() || other.IsNone()) { return(None()); } IDictionary <T, Domain> Intersected = this.Domains.ToDictionary(x => x.Key, x => x.Value); foreach (KeyValuePair <T, Domain> Item in other.Domains) { if (!Intersected.ContainsKey(Item.Key)) { Intersected.Add(Item.Key, Item.Value); } else { Intersected[Item.Key] = Item.Value.Intersect(Intersected[Item.Key]); } } return(WithColumnDomains(Intersected)); }
/// <summary> /// Returns true only if the this TupleDomain contains all possible tuples that would be allowable by /// the other TupleDomain. /// </summary> /// <param name="domains"></param> /// <returns></returns> public bool Contains(TupleDomain <T> other) { return(other.IsNone() || ColumnWiseUnion(this, other).Equals(this)); }