public Dictionary<string, SearchResult> Search(RedlineDocument doc)
        {

            _results = new Dictionary<string, SearchResult>();

            ProcessCollection(doc, true);

            return _results;
        }
Example #2
0
 public static Dictionary<string, SearchResult> ExecuteInternal(List<string> searchTerms, RedlineDocument doc, Predicate<ChangeType> changeTypeSelector, Predicate<DocObject> contextExcluder, bool caseInsensitive = false)
 {
     RedlineStateMachine rsm = new RedlineStateMachine(caseInsensitive);
     StateMachineBuilder bld = new StateMachineBuilder(rsm);
     bld.Execute(searchTerms);
     rsm.ChangeTypeSelector = changeTypeSelector;
     rsm.ContextExcluder = contextExcluder;
     return rsm.Search(doc);
 }
Example #3
0
        public RedlineDocument Execute()
        {
            using (XmlReader reader = XmlReader.Create(m_source, new XmlReaderSettings { }))
            {
                _consumerStack = new Stack<IXmlConsumer>();
                RedlineDocument result = new RedlineDocument();
                _consumerStack.Push(result);
                reader.MoveToContent();

                ProcessNodes(reader);

                result.MoveLooseNodesIntoFirstSection();

                return result;
            }
        }
Example #4
0
        public static Dictionary<string, SearchResult> Execute(List<string> searchTerms, RedlineDocument doc, Predicate<ChangeType> changeTypeSelector, Predicate<DocObject> contextExcluder, bool caseInsensitive = false)
        {
            Dictionary<string, SearchResult> results = new Dictionary<string, SearchResult>();

            List<string> batch = new List<string>();
            for (int i = 0; i < searchTerms.Count; i++)
            {
                batch.Add(searchTerms[i]);
                if (batch.Count == 100)
                {
                    DoBatch(doc, changeTypeSelector, contextExcluder, caseInsensitive, results, batch);
                    batch.Clear();
                }

            }

            if (batch.Count>0)
                DoBatch(doc, changeTypeSelector, contextExcluder, caseInsensitive, results, batch);

            return results;


        }
 public MatchingChangeFilter(RedlineDocument rd)
 {
     m_rd = rd;
 }
 public UnchangedPlaceholders(RedlineDocument rd)
 {
     m_rd = rd;
     LoadPlaceholderStrings();
 }
Example #7
0
 public static Dictionary<string, SearchResult> SearchOriginal(List<string> patterns, RedlineDocument rd, Predicate<DocObject> contextExcluder)
 {
     return Execute(patterns, rd, (ChangeType t) => Utils.IsInOriginalDocument(t), contextExcluder);
 }
Example #8
0
 private static void DoBatch(RedlineDocument doc, Predicate<ChangeType> changeTypeSelector, Predicate<DocObject> contextExcluder, bool caseInsensitive, Dictionary<string, SearchResult> results, List<string> batch)
 {
     var subResult = ExecuteInternal(batch, doc, changeTypeSelector, contextExcluder, caseInsensitive);
     MergeResults(results, subResult);
 }
 public RedlineCharPosCalculator(RedlineDocument targetDoc, IRedlineCharCounter counter)
 {
     _doc = targetDoc;
     _counter = counter;
 }
Example #10
0
 private int SearchWholeWord(string p, RedlineDocument rd)
 {
     string searchTerm = RedlineMLSearch.AnyWordBreak + p + RedlineMLSearch.AnyWordBreak;
     var result = RedlineMLSearch.Execute(new List<string>() { searchTerm }, rd, (ChangeType t) => true, (x) => false);
     Assert.AreEqual(1, result.Count);
     return result[searchTerm].Count;
 }
Example #11
0
 private DocObject FindObject(RedlineDocument rd, Location l)
 {
     DocObject result = null;
     DocObjectWithContent container = rd;
     foreach (LocationElement le in l.LocationStack)
     {
         Assert.AreSame(container, le.Container);
         result = container.Content[le.ChildIndex];
         container = result as DocObjectWithContent;
     }
     return result;
 }