recurrent = (REMatch) current.clone(); if (token.match(input, recurrent)) { // add all items in current to doables array if (doables == null) { doables = recurrent; doablesLast = recurrent; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) doablesLast.next = recurrent; } // Find new doablesLast while (doablesLast.next != null) { doablesLast = doablesLast.next; } }
single = (REMatch) current.clone(); if (next(input, single)) { // chain results to doneIndex if (doneIndex == null) { doneIndex = single; doneIndexLast = single; } else { doneIndexLast.next = single; } // Find new doneIndexLast while (doneIndexLast.next != null) { doneIndexLast = doneIndexLast.next; } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/gnu/regexp/RETokenRepeated.java File path: /jEdit-4.2/src/gnu/regexp/RETokenRepeated.java
Method name: boolean match(CharIndexed, REMatch) Method name: REMatch matchRest(CharIndexed, REMatch)
Number of AST nodes: 8 Number of AST nodes: 8
1
recurrent = (REMatch) current.clone();
1
single = (REMatch) current.clone();
2
		if (token.match(input, recurrent)) {
2
	
3
		    // add all items in current to doables array
4
		    if (doables == null) {
5
			doables = recurrent;
6
			doablesLast = recurrent;
7
		    } else {
8
			// Order these from longest to shortest
9
			// Start by assuming longest (more repeats)
10
			doablesLast.next = recurrent;
11
		    }
12
		    
3
    if (next(input, single)) {
4
		// chain results to doneIndex
5
		if (doneIndex == null) {
6
		    doneIndex = single;
7
		    doneIndexLast = single;
8
		} else {
9
		    doneIndexLast.next = single;
10
		}
13
// Find new doablesLast
11
		// Find new doneIndexLast
14
		    while (doablesLast.next != null) {
12
		while (doneIndexLast.next != null) {
15
			doablesLast = doablesLast.next;
13
		    doneIndexLast = doneIndexLast.next;
16
		
14
		}
17
    }
15
	    }
18
		}
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.6
Clones locationClones are declared in the same class
Number of node comparisons36
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    recurrent = (REMatch)current.clone();
    18
    recurrent = (REMatch)current.clone();
    5
    single = (REMatch)current.clone();
    Differences
    Expression1Expression2Difference
    recurrentsingleVARIABLE_NAME_MISMATCH
    5
    single = (REMatch)current.clone();
    19
    if (token.match(input, recurrent))
    19
    if (token.match(input, recurrent))
    6
    if (next(input, single))
    Differences
    Expression1Expression2Difference
    matchnextMETHOD_INVOCATION_NAME_MISMATCH
    recurrentsingleVARIABLE_NAME_MISMATCH
    tokenMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression next(input,single) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression next(input,single) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (next(input, single))
    20
    if (doables == null)
    20
    if (doables == null)
    7
    if (doneIndex == null)
    Differences
    Expression1Expression2Difference
    doablesdoneIndexVARIABLE_NAME_MISMATCH
    7
    if (doneIndex == null)
    21
    doables = recurrent;
    21
    doables = recurrent;
    8
    doneIndex = single;
    Differences
    Expression1Expression2Difference
    doablesdoneIndexVARIABLE_NAME_MISMATCH
    recurrentsingleVARIABLE_NAME_MISMATCH
    8
    doneIndex = single;
    22
    doablesLast = recurrent;
    22
    doablesLast = recurrent;
    9
    doneIndexLast = single;
    Differences
    Expression1Expression2Difference
    doablesLastdoneIndexLastVARIABLE_NAME_MISMATCH
    recurrentsingleVARIABLE_NAME_MISMATCH
    9
    doneIndexLast = single;
    else
    else
    23
    doablesLast.next = recurrent;
    23
    doablesLast.next = recurrent;
    10
    doneIndexLast.next = single;
    Differences
    Expression1Expression2Difference
    doablesLastdoneIndexLastVARIABLE_NAME_MISMATCH
    recurrentsingleVARIABLE_NAME_MISMATCH
    10
    doneIndexLast.next = single;
    24
    while (doablesLast.next != null)
    24
    while (doablesLast.next != null)
    11
    while (doneIndexLast.next != null)
    Differences
    Expression1Expression2Difference
    doablesLastdoneIndexLastVARIABLE_NAME_MISMATCH
    11
    while (doneIndexLast.next != null)
    25
    doablesLast = doablesLast.next;
    25
    doablesLast = doablesLast.next;
    12
    doneIndexLast = doneIndexLast.next;
    Differences
    Expression1Expression2Difference
    doablesLastdoneIndexLastVARIABLE_NAME_MISMATCH
    doablesLastdoneIndexLastVARIABLE_NAME_MISMATCH
    12
    doneIndexLast = doneIndexLast.next;
    Precondition Violations (5)
    Row Violation
    1Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression next(input,single) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression next(input,single) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables doables, doablesLast , while Clone fragment #2 returns variables doneIndex, doneIndexLast