public bool MoveNext() { if (InnerLookup.IsDefaultValue()) { InnerLookup = CommonImplementation.ToLookupImpl(ref Right, RightKeySelector); } while (Left.MoveNext()) { var cur = Left.Current; var curKey = LeftKeySelector(cur); if (curKey == null) { Current = ResultSelector(cur, EmptyCache <TKeyItem, TRightItem> .EmptyGrouped); 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, LookupDefaultEnumerable <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>, LookupDefaultEnumerable <TGenLookupKey, TGenLookupElement>, LookupDefaultEnumerator <TGenLookupKey, TGenLookupElement> >(RefLocal(firstBridged), ref second, resultSelector)); }
public static int Count <TLookupKey, TLookupElement>(this LookupDefaultEnumerable <TLookupKey, TLookupElement> source) { if (source.IsDefaultValue()) { throw CommonImplementation.Uninitialized(nameof(source)); } return(source.Count); }
> Except <TGenGroupByKey, TGenGroupByElement>( BuiltInEnumerable <GroupingEnumerable <TGenGroupByKey, TGenGroupByElement> > first, LookupDefaultEnumerable <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> >, LookupDefaultEnumerable <TGenGroupByKey, TGenGroupByElement>, LookupDefaultEnumerator <TGenGroupByKey, TGenGroupByElement> >(RefLocal(firstBridge), ref second)); }
> Join <TOutItem, TJoinKeyItem, TJoinLeftItem, TGenLookupKey, TGenLookupElement>( BuiltInEnumerable <TJoinLeftItem> outer, LookupDefaultEnumerable <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>, LookupDefaultEnumerable <TGenLookupKey, TGenLookupElement>, LookupDefaultEnumerator <TGenLookupKey, TGenLookupElement> >(RefLocal(outerBridge), ref inner, outerKeySelector, innerKeySelector, resultSelector, comparer)); }
public bool SequenceEqual <TGenKey, TGenElement>( BuiltInEnumerable <GroupingEnumerable <TGenKey, TGenElement> > first, LookupDefaultEnumerable <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> >, LookupDefaultEnumerable <TGenKey, TGenElement>, LookupDefaultEnumerator <TGenKey, TGenElement> >(RefLocal(firstBridge), ref second)); }
> GroupJoin <TResult, TGroupJoinKey, TOuter, TGenLookupKey, TGenLookupElement>( BuiltInEnumerable <TOuter> outer, LookupDefaultEnumerable <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>, LookupDefaultEnumerable <TGenLookupKey, TGenLookupElement>, LookupDefaultEnumerator <TGenLookupKey, TGenLookupElement> >(RefLocal(outerBridge), ref inner, outerKeySelector, innerKeySelector, resultSelector)); }
public bool MoveNext() { if (InnerLookup.IsDefaultValue()) { InnerLookup = CommonImplementation.ToLookupImpl(ref Right, RightKeySelector); } 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); }