public ParamSet Except(ParamSet other) { var joinIndexes = ValueIndexes .Intersect(other.ValueIndexes) .ToArray(); var ad = Params .GroupBy(p => GetKey(p, joinIndexes)) .ToDictionary(k => k.Key, k => k.ToList()); foreach (var op in other.Params) { var key = GetKey(op, joinIndexes); if (ad.ContainsKey(key)) { //Console.WriteLine(key); ad.Remove(key); } } var ret = ad.SelectMany(g => g.Value).ToList(); var newIndexes = ValueIndexes .Union(other.ValueIndexes) .ToArray(); return(new ParamSet(ret, newIndexes)); }
public ParamSet Join(ParamSet other) { var joinIndexes = ValueIndexes .Intersect(other.ValueIndexes) .ToArray(); if (!joinIndexes.Any()) { } var p = Params .Join( other.Params, k => GetKey(k, joinIndexes), k => GetKey(k, joinIndexes), Join ) .Where(pa => pa != null) .ToList(); var newIndexes = ValueIndexes .Union(other.ValueIndexes) .ToArray(); return(new ParamSet(p, newIndexes)); }