public bool MoveNext() { if (InnerLookup.IsDefaultValue()) { InnerLookup = CommonImplementation.ToLookupImpl(ref Right, RightKeySelector, Comparer); } while (Left.MoveNext()) { var cur = Left.Current; var curKey = LeftKeySelector(cur); if (curKey == null) { var nullGroup = EmptyCache <TKeyItem, TRightItem> .EmptyGrouping; Current = ResultSelector(cur, new GroupedEnumerable <TKeyItem, TRightItem>(ref nullGroup)); return(true); } var forKey = InnerLookup[curKey]; var asGrouped = new GroupedEnumerable <TKeyItem, TRightItem>(ref forKey); Current = ResultSelector(cur, asGrouped); return(true); } return(false); }
> Zip <TOutItem, TFirstItem, TGenLookupKey, TGenLookupElement>( BuiltInEnumerable <TFirstItem> first, LookupSpecificEnumerable <TGenLookupKey, TGenLookupElement> second, Func <TFirstItem, GroupingEnumerable <TGenLookupKey, TGenLookupElement>, TOutItem> resultSelector ) { var firstBridged = Bridge(first, nameof(first)); if (second.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(second)); } if (resultSelector == null) { throw CommonImplementation.ArgumentNull(nameof(resultSelector)); } return (CommonImplementation.ZipImpl < TOutItem, TFirstItem, GroupingEnumerable <TGenLookupKey, TGenLookupElement>, BuiltInEnumerable <TFirstItem>, BuiltInEnumerator <TFirstItem>, LookupSpecificEnumerable <TGenLookupKey, TGenLookupElement>, LookupSpecificEnumerator <TGenLookupKey, TGenLookupElement> >(RefLocal(firstBridged), ref second, resultSelector)); }
public static int Count <TLookupKey, TLookupElement>(this LookupSpecificEnumerable <TLookupKey, TLookupElement> source) { if (source.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(source)); } return(source.Count); }
> Except <TGenGroupByKey, TGenGroupByElement>( BuiltInEnumerable <GroupingEnumerable <TGenGroupByKey, TGenGroupByElement> > first, LookupSpecificEnumerable <TGenGroupByKey, TGenGroupByElement> second ) { var firstBridge = Bridge(first, nameof(first)); if (second.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(second)); } return(CommonImplementation.ExceptImpl < GroupingEnumerable <TGenGroupByKey, TGenGroupByElement>, BuiltInEnumerable <GroupingEnumerable <TGenGroupByKey, TGenGroupByElement> >, BuiltInEnumerator <GroupingEnumerable <TGenGroupByKey, TGenGroupByElement> >, LookupSpecificEnumerable <TGenGroupByKey, TGenGroupByElement>, LookupSpecificEnumerator <TGenGroupByKey, TGenGroupByElement> >(RefLocal(firstBridge), ref second)); }
> Join <TOutItem, TJoinKeyItem, TJoinLeftItem, TGenLookupKey, TGenLookupElement>( BuiltInEnumerable <TJoinLeftItem> outer, LookupSpecificEnumerable <TGenLookupKey, TGenLookupElement> inner, Func <TJoinLeftItem, TJoinKeyItem> outerKeySelector, Func <GroupingEnumerable <TGenLookupKey, TGenLookupElement>, TJoinKeyItem> innerKeySelector, Func <TJoinLeftItem, GroupingEnumerable <TGenLookupKey, TGenLookupElement>, TOutItem> resultSelector, IEqualityComparer <TJoinKeyItem> comparer ) { var outerBridge = Bridge(outer, nameof(outer)); if (inner.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(inner)); } if (outerKeySelector == null) { throw CommonImplementation.ArgumentNull(nameof(outerKeySelector)); } if (innerKeySelector == null) { throw CommonImplementation.ArgumentNull(nameof(innerKeySelector)); } if (resultSelector == null) { throw CommonImplementation.ArgumentNull(nameof(resultSelector)); } return (CommonImplementation.JoinImpl < TOutItem, TJoinKeyItem, TJoinLeftItem, BuiltInEnumerable <TJoinLeftItem>, BuiltInEnumerator <TJoinLeftItem>, GroupingEnumerable <TGenLookupKey, TGenLookupElement>, LookupSpecificEnumerable <TGenLookupKey, TGenLookupElement>, LookupSpecificEnumerator <TGenLookupKey, TGenLookupElement> >(RefLocal(outerBridge), ref inner, outerKeySelector, innerKeySelector, resultSelector, comparer)); }
public bool SequenceEqual <TGenKey, TGenElement>( BuiltInEnumerable <GroupingEnumerable <TGenKey, TGenElement> > first, LookupSpecificEnumerable <TGenKey, TGenElement> second ) { var firstBridge = Bridge(first, nameof(second)); if (second.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(second)); } return (CommonImplementation.SequenceEqualImpl < GroupingEnumerable <TGenKey, TGenElement>, BuiltInEnumerable <GroupingEnumerable <TGenKey, TGenElement> >, BuiltInEnumerator <GroupingEnumerable <TGenKey, TGenElement> >, LookupSpecificEnumerable <TGenKey, TGenElement>, LookupSpecificEnumerator <TGenKey, TGenElement> >(RefLocal(firstBridge), ref second)); }
> GroupJoin <TResult, TGroupJoinKey, TOuter, TGenLookupKey, TGenLookupElement>( BuiltInEnumerable <TOuter> outer, LookupSpecificEnumerable <TGenLookupKey, TGenLookupElement> inner, Func <TOuter, TGroupJoinKey> outerKeySelector, Func <GroupingEnumerable <TGenLookupKey, TGenLookupElement>, TGroupJoinKey> innerKeySelector, Func <TOuter, GroupedEnumerable <TGroupJoinKey, GroupingEnumerable <TGenLookupKey, TGenLookupElement> >, TResult> resultSelector ) { var outerBridge = Bridge(outer, nameof(outer)); if (inner.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(inner)); } if (outerKeySelector == null) { throw CommonImplementation.ArgumentNull(nameof(outerKeySelector)); } if (innerKeySelector == null) { throw CommonImplementation.ArgumentNull(nameof(innerKeySelector)); } if (resultSelector == null) { throw CommonImplementation.ArgumentNull(nameof(resultSelector)); } return (CommonImplementation.GroupJoinImpl < TResult, TGroupJoinKey, TOuter, BuiltInEnumerable <TOuter>, BuiltInEnumerator <TOuter>, GroupingEnumerable <TGenLookupKey, TGenLookupElement>, LookupSpecificEnumerable <TGenLookupKey, TGenLookupElement>, LookupSpecificEnumerator <TGenLookupKey, TGenLookupElement> >(RefLocal(outerBridge), ref inner, outerKeySelector, innerKeySelector, resultSelector)); }
public bool MoveNext() { if (InnerLookup.IsDefaultValue()) { InnerLookup = CommonImplementation.ToLookupImpl(ref Right, RightKeySelector, Comparer); } continueYielding: if (!NeedsYield.IsDefaultValue()) { if (NeedsYield.MoveNext()) { var rightCur = NeedsYield.Current; Current = ResultSelector(CurrentKey, rightCur); return(true); } NeedsYield.Dispose(); NeedsYield = default(GroupingEnumerator <TRightItem>); } while (Left.MoveNext()) { var cur = Left.Current; var curKey = LeftKeySelector(cur); if (curKey == null) { continue; } CurrentKey = cur; NeedsYield = InnerLookup[curKey].GetEnumerator(); goto continueYielding; } return(false); }