Ejemplo n.º 1
0
 private bool shouldWrapNotFilterInParenthesis(NotFilter item)
 {
     // if the child is a filter group with more than one child, wrap in parentheses
     // unless, it would result in double wrapping
     FilterGroup group = item.Filter as FilterGroup;
     if (group == null || group.Count == 1 || (group.WrapInParentheses ?? options.WrapFiltersInParentheses))
     {
         return false;
     }
     return true;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Visits a NotFilter builder.
 /// </summary>
 /// <param name="item">The item to visit.</param>
 protected internal virtual void VisitNotFilter(NotFilter item)
 {
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Generates the text for a NotFilter builder.
 /// </summary>
 /// <param name="item">The NotFilter builder to generate the text for.</param>
 protected internal override void VisitNotFilter(NotFilter item)
 {
     Action visitor = () =>
     {
         writer.Write("NOT ");
         bool wrapInParenthesis = shouldWrapNotFilterInParenthesis(item);
         if (wrapInParenthesis)
         {
             writer.Write("(");
         }
         item.Filter.Accept(forSubCommand());
         if (wrapInParenthesis)
         {
             writer.Write(")");
         }
     };
     visitFilter(item, visitor);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Visits a NotFilter builder.
 /// </summary>
 /// <param name="item">The item to visit.</param>
 protected internal virtual void VisitNotFilter(NotFilter item)
 {
 }