private void AddResultsByDirection(DuplicateInfo result, int index1, int index2, ILanguage language, int direction) { index1 = GetNextLineIndex(index1, language, direction); index2 = GetNextLineIndex(index2, language, direction); while (index1 != -1 && index2 != -1 && _fileLines[index1].Line == _fileLines[index2].Line) { result.Add(index1, index2); index1 = GetNextLineIndex(index1, language, direction); index2 = GetNextLineIndex(index2, language, direction); } }
private DuplicateInfo GetEqualLines(int sortedLineNumber1, int sortedLineNumber2, ILanguage language) { var result = new DuplicateInfo(); int unsortedLineNumber1 = _sortedFileLines[sortedLineNumber1].IndexInUnsortedArray; int unsortedLineNumber2 = _sortedFileLines[sortedLineNumber2].IndexInUnsortedArray; result.Add(unsortedLineNumber1, unsortedLineNumber2); AddResultsByDirection(result, unsortedLineNumber1, unsortedLineNumber2, language, 1); AddResultsByDirection(result, unsortedLineNumber1, unsortedLineNumber2, language, -1); RemoveWrongStartLines(result, language); RemoveWrongEndLines(result, language); return(result); }