public virtual void Accept(IQueryNodeVisitor visitor, bool visitChildren = true) { if (this is GroupNode) { visitor.Visit((GroupNode)this); } else if (this is TermNode) { visitor.Visit((TermNode)this); } else if (this is FieldExpressionNode) { visitor.Visit((FieldExpressionNode)this); } if (!visitChildren) { return; } foreach (var child in this.Where(child => child != null)) { child.Accept(visitor); } }
public virtual Task AcceptAsync(IQueryNodeVisitor visitor, IQueryVisitorContext context) { if (this is GroupNode) { return(visitor.VisitAsync((GroupNode)this, context)); } if (this is TermNode) { return(visitor.VisitAsync((TermNode)this, context)); } if (this is TermRangeNode) { return(visitor.VisitAsync((TermRangeNode)this, context)); } if (this is MissingNode) { return(visitor.VisitAsync((MissingNode)this, context)); } if (this is ExistsNode) { return(visitor.VisitAsync((ExistsNode)this, context)); } return(Task.CompletedTask); }
public virtual Task AcceptAsync(IQueryNodeVisitor visitor, IQueryVisitorContext context) { if (this is GroupNode node) { return(visitor.VisitAsync(node, context)); } if (this is TermNode termNode) { return(visitor.VisitAsync(termNode, context)); } if (this is TermRangeNode rangeNode) { return(visitor.VisitAsync(rangeNode, context)); } if (this is MissingNode missingNode) { return(visitor.VisitAsync(missingNode, context)); } if (this is ExistsNode existsNode) { return(visitor.VisitAsync(existsNode, context)); } return(Task.CompletedTask); }