/// <summary> /// Adds a search for DomNode property names or values with a matching string</summary> /// <param name="predicate">Predicate to which the property search expression is added</param> /// <param name="target">Whether search is on DomNode property names or property values</param> /// <exception cref="InvalidOperationException">Unhandled property search target type</exception> protected void BuildStringPredicate(DomNodePropertyPredicate predicate, DomNodeQuery.PropertySearchTarget target) { switch(target) { case DomNodeQuery.PropertySearchTarget.Name: predicate.AddNameStringSearchExpression(TextInput, SelectedItem.Tag, m_isReplacePattern); break; case DomNodeQuery.PropertySearchTarget.Value: predicate.AddValueStringSearchExpression(TextInput, SelectedItem.Tag, m_isReplacePattern); break; default: throw new InvalidOperationException("Unhandled property search target type"); } }
/// <summary> /// Parses query tree to build list of predicates, with which the search is made</summary> /// <returns>Search predicates</returns> public override IQueryPredicate GetPredicate() { DomNodePropertyPredicate predicate = new DomNodePropertyPredicate(); BuildPredicate(predicate); return predicate; }