public static Filter Parse(string text) { var or = Or.Match(text); if (or.Success) { return(new LogicalFilter ( Parse(or.Groups["Left"].Value), LogicalOperator.Or, Parse(or.Groups["Right"].Value) )); } var and = And.Match(text); if (and.Success) { return(new LogicalFilter ( Parse(and.Groups["Left"].Value), LogicalOperator.And, Parse(and.Groups["Right"].Value) )); } var predicate = Predicate.Match(text); if (predicate.Success) { return(new PredicateFilter ( FilterProperty.Parse(predicate.Groups["Property"].Value), PredicateOperator.Parse(predicate.Groups["Predicate"].Value), FilterValue.Parse(predicate.Groups["Value"].Value) )); } throw new ArgumentException($"Couldn't parse filter '{text}'."); }
public PredicateFilter(FilterProperty property, PredicateOperator predicate, FilterValue value) { Property = property; Predicate = predicate; Value = value; }