Пример #1
0
        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);
        }
Пример #2
0
        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;
        }
Пример #3
0
        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();
        }