private bool IsUnder(NodeQueryMarcher matcher, SearchResult result) { if (!(result.Node is ParentedNode parented)) { return(true); } foreach (var parent in parented.GetParentChain()) { if (matcher.IsMatch(parent) != null) { return(true); } } return(false); }
private void Visit(object node, NodeQueryMarcher matcher, CancellationTokenSource cancellationTokenSource) { if (cancellationTokenSource.IsCancellationRequested) { return; } if (resultSet.Count > MaxResults) { cancellationTokenSource.Cancel(); return; } var result = matcher.IsMatch(node); if (result != null) { result.Node = node; resultSet.Add(result); } }