if(subregion != lineInfos.length - 1 && !ignoreWrap) { return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1], x,true); } else { int nextLine = textArea.displayManager .getNextVisibleLine(physicalLine); if(nextLine == -1) return -1; else { return textArea.getLineStartOffset(nextLine) + xToSubregionOffset(nextLine,0, x,true); } }
if(subregion != 0 && !ignoreWrap) { return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1], x,true); } else { int prevLine = textArea.displayManager .getPrevVisibleLine(physicalLine); if(prevLine == -1) return -1; else { return textArea.getLineStartOffset(prevLine) + xToSubregionOffset(prevLine,-1, x,true); } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/ChunkCache.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/ChunkCache.java
Method name: int getBelowPosition(int, int, int, boolean) Method name: int getAbovePosition(int, int, int, boolean)
Number of AST nodes: 6 Number of AST nodes: 6
1
if(subregion != lineInfos.length - 1 && !ignoreWrap)
1
if(subregion != 0 && !ignoreWrap)
2
		{
2
		{
3
			return textArea.getLineStartOffset(physicalLine)
3
			return textArea.getLineStartOffset(physicalLine)
4
				+ xToSubregionOffset(lineInfos[subregion + 1],
4
				+ xToSubregionOffset(lineInfos[subregion - 1],
5
				x,true);
5
				x,true);
6
		}
6
		}
7
		else
7
		else
8
		{
8
		{
9
			int nextLine = textArea.displayManager
9
			int prevLine = textArea.displayManager
10
				.getNextVisibleLine(physicalLine);
10
				.getPrevVisibleLine(physicalLine);
11
			if(nextLine == -1)
11
			if(prevLine == -1)
12
				return -1;
12
				return -1;
13
			else
13
			else
14
			{
14
			{
15
				return textArea.getLineStartOffset(nextLine)
15
				return textArea.getLineStartOffset(prevLine)
16
					+ xToSubregionOffset(nextLine,0,
16
					+ xToSubregionOffset(prevLine,-1,
17
					x,true);
17
					x,true);
18
			}
18
			}
19
		}
19
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)8.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    if (subregion != lineInfos.length - 1 && !ignoreWrap)
    3
    if (subregion != lineInfos.length - 1 && !ignoreWrap)
    3
    if (subregion != 0 && !ignoreWrap)
    Differences
    Expression1Expression2Difference
    lineInfos.length - 10INFIX_RIGHT_OPERAND_MISMATCH
    3
    if (subregion != 0 && !ignoreWrap)
                                                                                                                                                                                                                        
    4
    return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1], x, true);
    Preondition Violations
    Unmatched statement return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true);
    4
    return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1], x, true);
    4
    return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1], x, true);
    4
    return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1], x, true);
    Preondition Violations
    Unmatched statement return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true);
                                                                                                                                                                                                                        
    else
    else
    5
    int nextLine = textArea.displayManager.getNextVisibleLine(physicalLine);
    5
    int nextLine = textArea.displayManager.getNextVisibleLine(physicalLine);
    5
    int prevLine = textArea.displayManager.getPrevVisibleLine(physicalLine);
    Differences
    Expression1Expression2Difference
    nextLineprevLineVARIABLE_NAME_MISMATCH
    getNextVisibleLinegetPrevVisibleLineMETHOD_INVOCATION_NAME_MISMATCH
    5
    int prevLine = textArea.displayManager.getPrevVisibleLine(physicalLine);
    6
    if (nextLine == -1)
    6
    if (nextLine == -1)
    6
    if (prevLine == -1)
    Differences
    Expression1Expression2Difference
    nextLineprevLineVARIABLE_NAME_MISMATCH
    6
    if (prevLine == -1)
    7
    return -1;
    7
    return -1;
    else
    else
    8
    return textArea.getLineStartOffset(nextLine) + xToSubregionOffset(nextLine, 0, x, true);
    8
    return textArea.getLineStartOffset(nextLine) + xToSubregionOffset(nextLine, 0, x, true);
    8
    return textArea.getLineStartOffset(prevLine) + xToSubregionOffset(prevLine, -1, x, true);
    Differences
    Expression1Expression2Difference
    nextLineprevLineVARIABLE_NAME_MISMATCH
    nextLineprevLineVARIABLE_NAME_MISMATCH
    0-1TYPE_COMPATIBLE_REPLACEMENT
    8
    return textArea.getLineStartOffset(prevLine) + xToSubregionOffset(prevLine, -1, x, true);
    Precondition Violations (4)
    Row Violation
    1Unmatched statement return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true);
    3Unmatched statement return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true);