if(insideCompoundEdit()) throw new InternalError("Unbalanced begin/endCompoundEdit()"); if(undosLast == null) return -1; else { undoCount--; int caret = undosLast.undo(); redosFirst = undosLast; undosLast = undosLast.prev; if(undosLast == null) undosFirst = null; return caret; }
if(insideCompoundEdit()) throw new InternalError("Unbalanced begin/endCompoundEdit()"); if(redosFirst == null) return -1; else { undoCount++; int caret = redosFirst.redo(); undosLast = redosFirst; if(undosFirst == null) undosFirst = undosLast; redosFirst = redosFirst.next; return caret; }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/buffer/UndoManager.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/buffer/UndoManager.java
Method name: int undo() Method name: int redo()
Number of AST nodes: 11 Number of AST nodes: 11
1
if(insideCompoundEdit())
1
if(insideCompoundEdit())
2
			throw new InternalError("Unbalanced begin/endCompoundEdit()");
2
			throw new InternalError("Unbalanced begin/endCompoundEdit()");
3
		if(undosLast == null)
3
		if(redosFirst == null)
4
			return -1;
4
			return -1;
5
		else
5
		else
6
		{
6
		{
7
			undoCount--;
7
			undoCount++;
8
			int caret = undosLast.undo();
8
			int caret = 
9
			redosFirst = undosLast;
9
redosFirst.redo();
10
			undosLast = undosLast.prev;
10
			undosLast = redosFirst;
11
			if(undosLast == null)
11
			if(undosFirst == null)
12
				undosFirst = null
12
				undosFirst = undosLast;
13
;
13
			redosFirst = redosFirst.next;
14
			return caret;
14
			return caret;
15
		}
15
		}
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 comparisons72
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (insideCompoundEdit())
    1
    if (insideCompoundEdit())
    2
    throw new InternalError("Unbalanced begin/endCompoundEdit()");
    2
    throw new InternalError("Unbalanced begin/endCompoundEdit()");
    3
    if (undosLast == null)
    3
    if (undosLast == null)
    3
    if (redosFirst == null)
    Differences
    Expression1Expression2Difference
    undosLastredosFirstVARIABLE_NAME_MISMATCH
    3
    if (redosFirst == null)
    4
    return -1;
    4
    return -1;
    else
    else
                                  
    5
    undoCount++;
    5
    undoCount--;
                                  
    6
    int caret = undosLast.undo();
    6
    int caret = undosLast.undo();
    6
    int caret = redosFirst.redo();
    Differences
    Expression1Expression2Difference
    undoredoMETHOD_INVOCATION_NAME_MISMATCH
    undosLastredosFirstVARIABLE_NAME_MISMATCH
    6
    int caret = redosFirst.redo();
    7
    redosFirst = undosLast;
    7
    redosFirst = undosLast;
    7
    undosLast = redosFirst;
    Differences
    Expression1Expression2Difference
    redosFirstundosLastVARIABLE_NAME_MISMATCH
    undosLastredosFirstVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression redosFirst is a field being modified, and thus it cannot be parameterized
    Expression undosLast is a field being modified, and thus it cannot be parameterized
    7
    undosLast = redosFirst;
    8
    undosLast = undosLast.prev;
    8
    undosLast = undosLast.prev;
    10
    redosFirst = redosFirst.next;
    Differences
    Expression1Expression2Difference
    undosLastredosFirstVARIABLE_NAME_MISMATCH
    undosLastredosFirstVARIABLE_NAME_MISMATCH
    prevnextVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression undosLast is a field being modified, and thus it cannot be parameterized
    Expression redosFirst is a field being modified, and thus it cannot be parameterized
    10
    redosFirst = redosFirst.next;
    9
    if (undosLast == null)
    9
    if (undosLast == null)
    8
    if (undosFirst == null)
    Differences
    Expression1Expression2Difference
    undosLastundosFirstVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression undosLast cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (undosFirst == null)
    10
    undosFirst = null;
    10
    undosFirst = null;
    9
    undosFirst = undosLast;
    Differences
    Expression1Expression2Difference
    nullundosLastTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression undosLast cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    undosFirst = undosLast;
    11
    return caret;
    11
    return caret;
    Precondition Violations (6)
    Row Violation
    1Expression redosFirst is a field being modified, and thus it cannot be parameterized
    2Expression undosLast is a field being modified, and thus it cannot be parameterized
    3Expression undosLast is a field being modified, and thus it cannot be parameterized
    4Expression redosFirst is a field being modified, and thus it cannot be parameterized
    5Expression undosLast cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression undosLast cannot be parameterized, because it has dependencies to/from statements that will be extracted