IEnumerator <Tup> GetGroupEnumerator() { var index = RelStatic.BuildIndex(_source, _kmap); foreach (var kvp in index) { var rva = kvp.Value.Select(t => new CommonRow(_tmap.Select(x => t[x]))).ToArray(); var newtuple = RelStatic.CreateByMap <Tup>(kvp.Key, _map, rva); Logger.Assert(newtuple.Degree == Heading.Degree); yield return(newtuple); } }
// enumerator for full join and compose (only the output is different) IEnumerator <Tup> GetFull() { var index = RelStatic.BuildIndex(_rightarg, _jmapright); var hash = new HashSet <TupBase>(); foreach (var tuple in _leftarg) { var key = RelStatic.CreateByMap <Tup>(tuple, _jmapleft); if (index.ContainsKey(key)) { foreach (var tother in index[key]) { var newtuple = RelStatic.CreateByMap <Tup>(tuple, _tmapleft, tother, _tmapright); if (!hash.Contains(newtuple)) { hash.Add(newtuple); Logger.Assert(newtuple.Degree == Heading.Degree); yield return(newtuple); } } } } }