LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine); int subregion = getSubregionOfOffset(offset,lineInfos); 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); } }
LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine); int subregion = getSubregionOfOffset(offset,lineInfos); 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: 8 Number of AST nodes: 8
1
LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine);
1
LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine);
2
		int subregion = getSubregionOfOffset(offset,lineInfos);
2
		int subregion = getSubregionOfOffset(offset,lineInfos);
3
		if(subregion != lineInfos.length - 1 && !ignoreWrap)
3
		if(subregion != 0 && !ignoreWrap)
4
		{
4
		{
5
			return textArea.getLineStartOffset(physicalLine)
5
			return textArea.getLineStartOffset(physicalLine)
6
				+ xToSubregionOffset(lineInfos[subregion + 1],
6
				+ xToSubregionOffset(lineInfos[subregion - 1],
7
				x,true);
7
				x,true);
8
		}
8
		}
9
		else
9
		else
10
		{
10
		{
11
			int nextLine = textArea.displayManager
11
			int prevLine = textArea.displayManager
12
				.getNextVisibleLine(physicalLine);
12
				.getPrevVisibleLine(physicalLine);
13
			if(nextLine == -1)
13
			if(prevLine == -1)
14
				return -1;
14
				return -1;
15
			else
15
			else
16
			{
16
			{
17
				return textArea.getLineStartOffset(nextLine)
17
				return textArea.getLineStartOffset(prevLine)
18
					+ xToSubregionOffset(nextLine,0,
18
					+ xToSubregionOffset(prevLine,-1,
19
					x,true);
19
					x,true);
20
			}
20
			}
21
		}
21
		}
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.4
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)9.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine);
    1
    LineInfo[] lineInfos = getLineInfosForPhysicalLine(physicalLine);
    2
    int subregion = getSubregionOfOffset(offset, lineInfos);
    2
    int subregion = getSubregionOfOffset(offset, lineInfos);
    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
    Preondition Violations
    Expression lineInfos.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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 (6)
    Row Violation
    1Expression lineInfos.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched 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
    3Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion - 1],x,true);
    4Unmatched 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
    5Unmatched return textArea.getLineStartOffset(physicalLine) + xToSubregionOffset(lineInfos[subregion + 1],x,true);
    6Clone fragment #1 returns variables lineInfos, subregion , while Clone fragment #2 returns variables lineInfos, subregion