public void AddMarks(TextOccurences occurences) { if (occurences == null) { throw new ArgumentNullException("occurences"); } lock (_marksSyncRoot) { if (occurences != TextOccurences.Empty && occurences.Count > 0) { _markLength = occurences.TextLength; var n = occurences.Positions; if (n != null) { if (_positions != null) { n.ForEachLessThan(_positions.GetMinX(), IncludeTextToScreenUpdate); n.ForEachGreaterThan(_positions.GetMaxX(), IncludeTextToScreenUpdate); } else { n.ForEachInOrder(IncludeTextToScreenUpdate); } } _positions = n; } } }
public void AddMarks(TextOccurences occurences) { if (occurences == null) throw new ArgumentNullException("occurences"); lock (_marksSyncRoot) { if (occurences != TextOccurences.Empty && occurences.Count > 0) { _markLength = occurences.TextLength; var n = occurences.Positions; if (n != null) { if (_positions != null) { n.ForEachLessThan(_positions.GetMinX(), IncludeTextToScreenUpdate); n.ForEachGreaterThan(_positions.GetMaxX(), IncludeTextToScreenUpdate); } else { n.ForEachInOrder(IncludeTextToScreenUpdate); } } _positions = n; } } }
public void ReplaceMarks(TextOccurences occurences, int start, int end, int tailOffset) { if (occurences == null) { throw new ArgumentNullException("occurences"); } lock (_marksSyncRoot) { if (_positions == null) { ReplaceMarks(occurences); return; } Treap markThatContainsStart = FindMarkThatContainsPosition(_positions, start); if (markThatContainsStart != null) { start = markThatContainsStart.x; } Treap right = null; Treap garbage = null; _positions.Split(start - 1, out _positions, out right); if (right != null) { right.Split(end, out garbage, out right); } if (garbage != null) { garbage.ForEachInOrder(IncludeTextToScreenUpdate); } if (occurences != TextOccurences.Empty && occurences.Count > 0) { _markLength = occurences.TextLength; occurences.Positions.ForEachInOrder(IncludeTextToScreenUpdate); _positions = Treap.Merge(_positions, occurences.Positions); } if (right != null) { TreapBuilder shiftedMarks = new TreapBuilder(); right.ForEachInOrder((x) => { shiftedMarks.Add(x + tailOffset); }); _positions = Treap.Merge(_positions, shiftedMarks.ToTreap()); } } }
public void ReplaceMarks(TextOccurences occurences) { if (occurences == null) { throw new ArgumentNullException("occurences"); } lock (_marksSyncRoot) { if (_positions != null) { _positions.ForEachInOrder(IncludeTextToScreenUpdate); _positions = null; } if (occurences != TextOccurences.Empty && occurences.Count > 0) { _markLength = occurences.TextLength; occurences.Positions.ForEachInOrder(IncludeTextToScreenUpdate); _positions = occurences.Positions; } } }
public SearchCompletedEventArgs(TextOccurences occurences) { _occurences = occurences; }
public void ReplaceMarks(TextOccurences occurences, int start, int end, int tailOffset) { if (occurences == null) throw new ArgumentNullException("occurences"); lock (_marksSyncRoot) { if (_positions == null) { ReplaceMarks(occurences); return; } Treap markThatContainsStart = FindMarkThatContainsPosition(_positions, start); if (markThatContainsStart != null) { start = markThatContainsStart.x; } Treap right = null; Treap garbage = null; _positions.Split(start - 1, out _positions, out right); if (right != null) { right.Split(end, out garbage, out right); } if (garbage != null) { garbage.ForEachInOrder(IncludeTextToScreenUpdate); } if (occurences != TextOccurences.Empty && occurences.Count > 0) { _markLength = occurences.TextLength; occurences.Positions.ForEachInOrder(IncludeTextToScreenUpdate); _positions = Treap.Merge(_positions, occurences.Positions); } if (right != null) { TreapBuilder shiftedMarks = new TreapBuilder(); right.ForEachInOrder((x) => { shiftedMarks.Add(x + tailOffset); }); _positions = Treap.Merge(_positions, shiftedMarks.ToTreap()); } } }
public void ReplaceMarks(TextOccurences occurences) { if (occurences == null) throw new ArgumentNullException("occurences"); lock (_marksSyncRoot) { if (_positions != null) { _positions.ForEachInOrder(IncludeTextToScreenUpdate); _positions = null; } if (occurences != TextOccurences.Empty && occurences.Count > 0) { _markLength = occurences.TextLength; occurences.Positions.ForEachInOrder(IncludeTextToScreenUpdate); _positions = occurences.Positions; } } }