private static Filtering <ZipPair <int, TSourceItem> > getFiltering( Zipping <int, TSourceItem> zipping, Expression <Func <ZipPair <int, TSourceItem>, bool> > zipPairNotPredicateExpression, Computing <int> countComputing, int capacity) { return(zipping.Filtering(zp => zp.LeftItem >= zipping.Filtering(zipPairNotPredicateExpression, capacity).Selecting(zp1 => zp1.LeftItem).Using(ic => ic.Count > 0 ? ic.Minimazing().Value : countComputing.Value).Value, capacity)); }
private static INotifyCollectionChanged getSource( INotifyCollectionChanged source, Expression <Func <TSourceItem, int, bool> > predicateExpression, int capacity) { Expression <Func <ZipPair <int, TSourceItem>, bool> > zipPairNotPredicateExpression = getZipPairNotPredicateExpression(predicateExpression); Computing <int> countComputing = Expr.Is(() => source != null ? ((IList)source).Count : 0).Computing(); Zipping <int, TSourceItem> zipping = countComputing.SequenceComputing() .Zipping <int, TSourceItem>(source); return(getFiltering(zipping, zipPairNotPredicateExpression, countComputing, capacity)); }
private static INotifyCollectionChanged getSource( IReadScalar <INotifyCollectionChanged> sourceScalar, Expression <Func <TSourceItem, int, bool> > predicateExpression, int capacity) { Expression <Func <ZipPair <int, TSourceItem>, bool> > zipPairNotPredicateExpression = getZipPairNotPredicateExpression(predicateExpression); Computing <int> countComputing = Expr.Is(() => sourceScalar.Value != null ? ((IList)sourceScalar.Value).Count : 0).Computing(); Zipping <int, TSourceItem> zipping = countComputing.SequenceComputing() .Zipping <int, TSourceItem>(sourceScalar); return(getFiltering(zipping, zipPairNotPredicateExpression, countComputing, capacity)); //return () => (INotifyCollectionChanged)Expr.Is(() => (INotifyCollectionChanged)getSource.Computing().Using(sc => // Expr.Is(() => ((IList) sc.Value).Count).SequenceComputing() // .Zipping<int, TSourceItem>(() => sc.Value)).Value).Computing().Using(zipping => zipping.Value.Filtering<ZipPair<int, TSourceItem>>(zp => zp.ItemLeft < zipping.Value.Filtering(zipPairNotPredicateExpression).Selecting(zp1 => zp1.ItemLeft).Minimazing(() => (((IList)zipping.Value).Count)).Value)).Value; }