public _IEnumerator_397(_IEnumerable_392 _enclosing, Iterables.IIncrementComparator <V1, V2> comparator) { this._enclosing = _enclosing; this.comparator = comparator; this.ready = false; this.pending = null; }
/// <summary> /// Same as /// <see cref="Merge{V1, V2, V3}(System.Collections.Generic.IEnumerable{T}, System.Collections.Generic.IEnumerable{T}, System.Collections.Generic.IEnumerable{T}, IIncrementComparator{V1, V2}, IIncrementComparator{V1, V2})"/> /// but using the given (symmetric) comparator. /// </summary> public static IEnumerable <Triple <V, V, V> > Merge <V>(IEnumerable <V> iter1, IEnumerable <V> iter2, IEnumerable <V> iter3, IComparator <V> comparator) { Iterables.IIncrementComparator <V, V> inc = null; return(Merge(iter1, iter2, iter3, inc, inc)); }
public _IIncrementComparator_485(Iterables.IIncrementComparator <V1, V3> comparatorB) { this.comparatorB = comparatorB; }
/// <summary> /// Iterates over triples of objects from three (sorted) iterators such that /// for every returned triple a (from iter1), b (from iter2), c (from iter3) /// satisfies the constraint that <code>comparator.compare(a,b) == /// comparator.compare(a,c) == 0</code>. /// </summary> /// <remarks> /// Iterates over triples of objects from three (sorted) iterators such that /// for every returned triple a (from iter1), b (from iter2), c (from iter3) /// satisfies the constraint that <code>comparator.compare(a,b) == /// comparator.compare(a,c) == 0</code>. Internally, this function first /// calls merge(iter1,iter2,comparatorA), and then merges that iterator /// with the iter3 by comparing based on the value returned by iter1. /// This is used, e.g. to return lines from three input files that have /// the same "key" as determined by the given comparator. /// </remarks> public static IEnumerable <Triple <V1, V2, V3> > Merge <V1, V2, V3>(IEnumerable <V1> iter1, IEnumerable <V2> iter2, IEnumerable <V3> iter3, Iterables.IIncrementComparator <V1, V2> comparatorA, Iterables.IIncrementComparator <V1, V3> comparatorB) { // partial merge on first two iterables IEnumerable <Pair <V1, V2> > partial = Merge(iter1, iter2, comparatorA); Iterables.IIncrementComparator <Pair <V1, V2>, V3> inc = new _IIncrementComparator_485(comparatorB); // flattens the pairs into triple Func <Pair <Pair <V1, V2>, V3>, Triple <V1, V2, V3> > flatten = null; return(Transform(Merge(partial, iter3, inc), flatten)); }
public _IEnumerable_392(Iterables _enclosing, IEnumerable <V1> iter1, IEnumerable <V2> iter2, Iterables.IIncrementComparator <V1, V2> comparator) { this._enclosing = _enclosing; this.iter1 = iter1; this.iter2 = iter2; this.comparator = comparator; this.iterA = iter1.GetEnumerator(); this.iterB = iter2.GetEnumerator(); }
/// <summary> /// Iterates over pairs of objects from two (sorted) iterators such that /// each pair a \in iter1, b \in iter2 returned has comparator.compare(a,b)==0. /// </summary> /// <remarks> /// Iterates over pairs of objects from two (sorted) iterators such that /// each pair a \in iter1, b \in iter2 returned has comparator.compare(a,b)==0. /// If the comparator says that a and b are not equal, we increment the /// iterator of the smaller value. If the comparator says that a and b are /// equal, we return that pair and increment both iterators. /// This is used, e.g. to return lines from two input files that have /// the same "key" as determined by the given comparator. /// The comparator will always be passed elements from the first iter as /// the first argument. /// </remarks> public static IEnumerable <Pair <V1, V2> > Merge <V1, V2>(IEnumerable <V1> iter1, IEnumerable <V2> iter2, Iterables.IIncrementComparator <V1, V2> comparator) { return(new _IEnumerable_392(this, iter1, iter2, comparator)); }