/// <summary> /// </summary> /// <param name="oldWords"></param> /// <param name="newWords"></param> /// <param name="startInOld"></param> /// <param name="endInOld"></param> /// <param name="startInNew"></param> /// <param name="endInNew"></param> /// <param name="options"></param> public MatchFinder(string[] oldWords, string[] newWords, int startInOld, int endInOld, int startInNew, int endInNew, MatchOptions options) { _oldWords = oldWords; _newWords = newWords; _startInOld = startInOld; _endInOld = endInOld; _startInNew = startInNew; _endInNew = endInNew; _options = options; }
private Match FindMatch(int startInOld, int endInOld, int startInNew, int endInNew) { // For large texts it is more likely that there is a Match of size bigger than maximum granularity. // If not then go down and try to find it with smaller granularity. for (int i = _matchGranularity; i > 0; i--) { var options = new MatchOptions { BlockSize = i, RepeatingWordsAccuracy = RepeatingWordsAccuracy, IgnoreWhitespaceDifferences = IgnoreWhitespaceDifferences }; var finder = new MatchFinder(_oldWords, _newWords, startInOld, endInOld, startInNew, endInNew, options); var match = finder.FindMatch(); if (match != null) { return(match); } } return(null); }
private Match FindMatch(int startInOld, int endInOld, int startInNew, int endInNew) { // For large texts it is more likely that there is a Match of size bigger than maximum granularity. // If not then go down and try to find it with smaller granularity. for (int i = _matchGranularity; i > 0 ; i--) { var options = new MatchOptions { BlockSize = i, RepeatingWordsAccuracy = RepeatingWordsAccuracy, IgnoreWhitespaceDifferences = IgnoreWhitespaceDifferences }; var finder = new MatchFinder(_oldWords, _newWords, startInOld, endInOld, startInNew, endInNew, options); var match = finder.FindMatch(); if (match != null) return match; } return null; }