public IEnumerable <IStructuralMatchResult> Search(IStructuralPatternHolder pattern, ISearchDomain searchDomain) { var results = new List <IStructuralMatchResult>(); var consumer = new FindResultConsumer <IStructuralMatchResult>(result => { var findResultStructural = result as FindResultStructural; if (findResultStructural != null && findResultStructural.DocumentRange.IsValid()) { return(findResultStructural.MatchResult); } return(null); }, match => { if (match != null) { results.Add(match); } return(FindExecution.Continue); }); DoSearch(pattern.Matcher, consumer, searchDomain); return(results); }
public IEnumerable<IStructuralMatchResult> Search(IStructuralPatternHolder pattern, ISearchDomain searchDomain) { var results = new List<IStructuralMatchResult>(); var consumer = new FindResultConsumer<IStructuralMatchResult>(result => { var findResultStructural = result as FindResultStructural; if (findResultStructural != null && findResultStructural.DocumentRange.IsValid()) { return findResultStructural.MatchResult; } return null; }, match => { if (match != null) { results.Add(match); } return FindExecution.Continue; }); DoSearch(pattern.Matcher, consumer, searchDomain); return results; }
private void DoSearch(IStructuralPatternHolder pattern, IFindResultConsumer <IStructuralMatchResult> consumer, ISearchDomain searchDomain) { var searcher = new StructuralSearcher(documentManager, pattern.Language, pattern.Matcher); var searchDomainSearcher = new StructuralSearchDomainSearcher <IStructuralMatchResult>( searchDomain, searcher, consumer, NullProgressIndicator.Instance, true); searchDomainSearcher.Run(); }