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;
 }
 /// <summary>
 /// Visits a NotFilter builder.
 /// </summary>
 /// <param name="item">The item to visit.</param>
 protected internal virtual void VisitNotFilter(NotFilter item)
 {
 }
 /// <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);
 }
 /// <summary>
 /// Visits a NotFilter builder.
 /// </summary>
 /// <param name="item">The item to visit.</param>
 protected internal virtual void VisitNotFilter(NotFilter item)
 {
 }