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, int startIndex, int count) { Zipping <int, TSourceItem> zipping = new Computing <int>(() => ((IList)source).Count).SequenceComputing() .Zipping <int, TSourceItem>(source); return(zipping.Filtering(zp => zp.LeftItem >= startIndex && zp.LeftItem < startIndex + count, count)); }
private static INotifyCollectionChanged getSource( INotifyCollectionChanged source, IReadScalar <int> startIndexScalar, IReadScalar <int> countScalar, int capacity) { Zipping <int, TSourceItem> zipping = new Computing <int>(() => ((IList)source).Count).SequenceComputing() .Zipping <int, TSourceItem>(source); return(zipping.Filtering(zp => zp.LeftItem >= startIndexScalar.Value && zp.LeftItem < startIndexScalar.Value + countScalar.Value, capacity)); }
private static INotifyCollectionChanged getSource( IReadScalar <INotifyCollectionChanged> sourceScalar, int startIndex, int count) { Zipping <int, TSourceItem> zipping = new Computing <int>(() => sourceScalar.Value != null ? ((IList)sourceScalar.Value).Count : 0) .SequenceComputing() .Zipping <int, TSourceItem>(sourceScalar); return(zipping.Filtering(zp => zp.LeftItem >= startIndex && zp.LeftItem < startIndex + count, count)); }
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; }
public NullPropagating( IReadScalar <TValue> source, Expression <Func <TValue, TResult> > getValueExpression) { _source = source; _getValueExpression = getValueExpression; MemberExpression getSourceValueExpression = Expression.PropertyOrField(Expression.Constant(source), nameof(IReadScalar <TValue> .Value)); _computing = new Computing <TResult>( Expression.Lambda <Func <TResult> >( Expression.Condition( Expression.NotEqual( getSourceValueExpression, Expression.Constant(null, typeof(TValue))), new ReplaceParameterVisitor( new Dictionary <ParameterExpression, Expression>() { { getValueExpression.Parameters[0], getSourceValueExpression } }).Visit(getValueExpression.Body), Expression.Constant(default(TResult), typeof(TResult))))); }