コード例 #1
0
        public override Func <TwitterStatus, long> GetNumericValueProvider()
        {
            var lnp = LeftValue.GetNumericValueProvider();
            var rnp = RightValue.GetNumericValueProvider();

            return(_ => lnp(_) - rnp(_));
        }
コード例 #2
0
        public sealed override Func <TwitterStatus, bool> GetBooleanValueProvider()
        {
            var l = LeftValue.GetNumericValueProvider();
            var r = RightValue.GetNumericValueProvider();

            return(BuildEvaluator(l, r));
        }
コード例 #3
0
        public override Func <TwitterStatus, long> GetNumericValueProvider()
        {
            var lnp = LeftValue.GetNumericValueProvider();
            var rnp = RightValue.GetNumericValueProvider();

            return(_ =>
            {
                var divider = rnp(_);
                return divider == 0 ? 0 : lnp(_) / divider;
            });
        }
コード例 #4
0
        public override Func <TwitterStatus, bool> GetBooleanValueProvider()
        {
            var rsp = RightValue.GetSetValueProvider();

            if (LeftValue.SupportedTypes.Contains(FilterExpressionType.Numeric))
            {
                var lnp = LeftValue.GetNumericValueProvider();
                return(_ => rsp(_).Contains(lnp(_)));
            }
            var lsp = LeftValue.GetSetValueProvider();

            return(_ =>
            {
                var rs = rsp(_);
                return lsp(_).Any(rs.Contains);
            });
        }
コード例 #5
0
        public override Func <TwitterStatus, bool> GetBooleanValueProvider()
        {
            switch (this.GetArgumentIntersectTypes())
            {
            case FilterExpressionType.Boolean:
                var lbp = LeftValue.GetBooleanValueProvider();
                var rbp = RightValue.GetBooleanValueProvider();
                return(_ => lbp(_) == rbp(_));

            case FilterExpressionType.Numeric:
                var lnp = LeftValue.GetNumericValueProvider();
                var rnp = RightValue.GetNumericValueProvider();
                return(_ => lnp(_) == rnp(_));

            case FilterExpressionType.String:
                var lsp = LeftValue.GetStringValueProvider();
                var rsp = RightValue.GetStringValueProvider();
                return(_ => String.Equals(lsp(_), rsp(_), GetStringComparison()));

            default:
                throw new InvalidOperationException("Invalid code path.");
            }
        }