public override Func <TwitterStatus, long> GetNumericValueProvider() { var lnp = LeftValue.GetNumericValueProvider(); var rnp = RightValue.GetNumericValueProvider(); return(_ => lnp(_) - rnp(_)); }
public sealed override Func <TwitterStatus, bool> GetBooleanValueProvider() { var l = LeftValue.GetNumericValueProvider(); var r = RightValue.GetNumericValueProvider(); return(BuildEvaluator(l, r)); }
public override Func <TwitterStatus, long> GetNumericValueProvider() { var lnp = LeftValue.GetNumericValueProvider(); var rnp = RightValue.GetNumericValueProvider(); return(_ => { var divider = rnp(_); return divider == 0 ? 0 : lnp(_) / divider; }); }
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); }); }
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."); } }