Ejemplo n.º 1
0
        private Filtering(Expression <Func <TSourceItem, bool> > predicateExpression,
                          int sourceCapacity, int capacity) : base(capacity)
        {
            _initialCapacity   = capacity;
            _filteredPositions = new Positions <Position>(new List <Position>(_initialCapacity));
            _itemInfos         = new List <ItemInfo>(sourceCapacity);
            _sourcePositions   = new Positions <ItemInfo>(_itemInfos);

            _predicateExpressionOriginal = predicateExpression;

            CallToConstantConverter callToConstantConverter =
                new CallToConstantConverter(predicateExpression.Parameters);

            _predicateExpression =
                (Expression <Func <TSourceItem, bool> >)callToConstantConverter.Visit(predicateExpression);
            _predicateContainsParametrizedObservableComputationsCalls =
                callToConstantConverter.ContainsParametrizedObservableComputationCalls;

            if (!_predicateContainsParametrizedObservableComputationsCalls)
            {
                _predicateExpressionInfo = ExpressionWatcher.GetExpressionInfo(_predicateExpression);
                // ReSharper disable once PossibleNullReferenceException
                _predicateFunc = _predicateExpression.Compile();
            }
        }
Ejemplo n.º 2
0
        public Computing(
            Expression <Func <TResult> > getValueExpression)
        {
            _changeValueAction          = () => setValue(getResult());
            _getValueExpressionOriginal = getValueExpression;

            CallToConstantConverter      callToConstantConverter = new CallToConstantConverter(_getValueExpressionOriginal.Parameters);
            Expression <Func <TResult> > getValueExpression1     =
                (Expression <Func <TResult> >)callToConstantConverter.Visit(_getValueExpressionOriginal);

            // ReSharper disable once PossibleNullReferenceException
            _getValueFunc   = getValueExpression1.Compile();
            _expressionInfo = ExpressionWatcher.GetExpressionInfo(getValueExpression1);
        }
Ejemplo n.º 3
0
        private Selecting(Expression <Func <TSourceItem, TResultItem> > selectorExpression, int capacity) : base(capacity)
        {
            _itemInfos       = new List <ItemInfo>(capacity);
            _sourcePositions = new Positions <ItemInfo>(_itemInfos);

            _selectorExpressionOriginal = selectorExpression;
            CallToConstantConverter callToConstantConverter =
                new CallToConstantConverter(_selectorExpressionOriginal.Parameters);

            _selectorExpression =
                (Expression <Func <TSourceItem, TResultItem> >)callToConstantConverter.Visit(
                    _selectorExpressionOriginal);
            _selectorContainsParametrizedObservableComputationsCalls =
                callToConstantConverter.ContainsParametrizedObservableComputationCalls;

            if (!_selectorContainsParametrizedObservableComputationsCalls)
            {
                _selectorExpressionInfo = ExpressionWatcher.GetExpressionInfo(_selectorExpression);
                // ReSharper disable once PossibleNullReferenceException
                _selectorFunc = _selectorExpression.Compile();
            }
        }