if(gapWidth != 0) { if(Debug.OFFSET_DEBUG && newGapLine != gapLine) Log.log(Log.DEBUG,this,method + ": update from " + newGapLine + " to " + gapLine + " width " + gapWidth); for(int i = newGapLine; i < gapLine; i++) setLineEndOffset(i,getLineEndOffset(i) - gapWidth); } gapWidth += newGapWidth;
if(gapWidth != 0) { if(Debug.OFFSET_DEBUG && gapLine != lineCount) Log.log(Log.DEBUG,this,method + ": update from " + gapLine + " to " + lineCount + " width " + gapWidth); for(int i = gapLine; i < lineCount; i++) setLineEndOffset(i,getLineEndOffset(i)); } gapWidth = newGapWidth;
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/buffer/LineManager.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/buffer/LineManager.java
Method name: void moveGap(int, int, String) Method name: void moveGap(int, int, String)
Number of AST nodes: 6 Number of AST nodes: 6
1
if(gapWidth != 0)
1
if(gapWidth != 0)
2
			{
2
			{
3
				if(Debug.OFFSET_DEBUG && newGapLine != gapLine)
3
				if(Debug.OFFSET_DEBUG && gapLine != lineCount)
4
					Log.log(Log.DEBUG,this,method + ": update from " + newGapLine + " to " + gapLine + " width " + gapWidth);
4
					Log.log(Log.DEBUG,this,method + ": update from " + gapLine + " to " + lineCount + " width " + gapWidth);
5
				for(int i = newGapLine; i < gapLine; i++)
5
				for(int i = gapLine; i < lineCount; i++)
6
					setLineEndOffset(i,getLineEndOffset(i) - gapWidth);
6
					setLineEndOffset(i,getLineEndOffset(i));
7
			}
7
			}
8
			gapWidth += newGapWidth;
8
			gapWidth = newGapWidth;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in the same method
Number of node comparisons13
  1. {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)3.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    if (gapWidth != 0)
    4
    if (gapWidth != 0)
    12
    if (Debug.OFFSET_DEBUG && newGapLine != gapLine)
    12
    if (Debug.OFFSET_DEBUG && newGapLine != gapLine)
    5
    if (Debug.OFFSET_DEBUG && gapLine != lineCount)
    Differences
    Expression1Expression2Difference
    newGapLinegapLineVARIABLE_NAME_MISMATCH
    gapLinelineCountVARIABLE_NAME_MISMATCH
    5
    if (Debug.OFFSET_DEBUG && gapLine != lineCount)
    13
    Log.log(Log.DEBUG, this, method + ": update from " + newGapLine + " to " + gapLine + " width " + gapWidth);
    13
    Log.log(Log.DEBUG, this, method + ": update from " + newGapLine + " to " + gapLine + " width " + gapWidth);
    6
    Log.log(Log.DEBUG, this, method + ": update from " + gapLine + " to " + lineCount + " width " + gapWidth);
    Differences
    Expression1Expression2Difference
    newGapLinegapLineVARIABLE_NAME_MISMATCH
    gapLinelineCountVARIABLE_NAME_MISMATCH
    6
    Log.log(Log.DEBUG, this, method + ": update from " + gapLine + " to " + lineCount + " width " + gapWidth);
    14
    for (int i = newGapLine; i < gapLine; i++)
    14
    for (int i = newGapLine; i < gapLine; i++)
    7
    for (int i = gapLine; i < lineCount; i++)
    Differences
    Expression1Expression2Difference
    newGapLinegapLineVARIABLE_NAME_MISMATCH
    gapLinelineCountVARIABLE_NAME_MISMATCH
    7
    for (int i = gapLine; i < lineCount; i++)
    15
    setLineEndOffset(i, getLineEndOffset(i) - gapWidth);
    15
    setLineEndOffset(i, getLineEndOffset(i) - gapWidth);
    8
    setLineEndOffset(i, getLineEndOffset(i));
    Differences
    Expression1Expression2Difference
    getLineEndOffset(i) - gapWidthgetLineEndOffset(i)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression getLineEndOffset(i) - gapWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression getLineEndOffset(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    setLineEndOffset(i, getLineEndOffset(i));
                                                    
    9
    gapWidth = newGapWidth;
    Preondition Violations
    Unmatched statement gapWidth=newGapWidth; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    9
    gapWidth = newGapWidth;
    16
    gapWidth += newGapWidth;
    16
    gapWidth += newGapWidth;
    Preondition Violations
    Unmatched statement gapWidth+=newGapWidth; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                        
    Precondition Violations (4)
    Row Violation
    1Expression getLineEndOffset(i) - gapWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression getLineEndOffset(i) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement gapWidth=newGapWidth; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement gapWidth+=newGapWidth; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted