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; } }
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; } }
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: REMatch matchRest(CharIndexed, REMatch) Method name: boolean match(CharIndexed, REMatch)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (next(input, single)) {
1
if (
2
		// chain results to doneIndex
3
		if (doneIndex == null) {
4
		    doneIndex = single;
5
		    doneIndexLast = single;
6
		} else {
7
		    doneIndexLast.next = single;
8
		}
9
		
2
token.match(input, recurrent)) {
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
		    }
10
// Find new doneIndexLast
12
		    // Find new doablesLast
11
		while (doneIndexLast.next != null) {
13
		    while (doablesLast.next != null) {
12
		    doneIndexLast = doneIndexLast.next;
14
			doablesLast = doablesLast.next;
13
		}
15
		
14
	    }
16
    }
17
		}
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.9
Clones locationClones are declared in the same class
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)132.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    if (next(input, single))
    6
    if (next(input, single))
    19
    if (token.match(input, recurrent))
    Differences
    Expression1Expression2Difference
    singlerecurrentVARIABLE_NAME_MISMATCH
    nextmatchMETHOD_INVOCATION_NAME_MISMATCH
    tokenMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    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
    Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19
    if (token.match(input, recurrent))
    7
    if (doneIndex == null)
    7
    if (doneIndex == null)
    20
    if (doables == null)
    Differences
    Expression1Expression2Difference
    doneIndexdoablesVARIABLE_NAME_MISMATCH
    20
    if (doables == null)
    8
    doneIndex = single;
    8
    doneIndex = single;
    21
    doables = recurrent;
    Differences
    Expression1Expression2Difference
    doneIndexdoablesVARIABLE_NAME_MISMATCH
    singlerecurrentVARIABLE_NAME_MISMATCH
    21
    doables = recurrent;
    9
    doneIndexLast = single;
    9
    doneIndexLast = single;
    22
    doablesLast = recurrent;
    Differences
    Expression1Expression2Difference
    doneIndexLastdoablesLastVARIABLE_NAME_MISMATCH
    singlerecurrentVARIABLE_NAME_MISMATCH
    22
    doablesLast = recurrent;
    else
    else
    10
    doneIndexLast.next = single;
    10
    doneIndexLast.next = single;
    23
    doablesLast.next = recurrent;
    Differences
    Expression1Expression2Difference
    doneIndexLastdoablesLastVARIABLE_NAME_MISMATCH
    singlerecurrentVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doablesLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23
    doablesLast.next = recurrent;
    11
    while (doneIndexLast.next != null)
    11
    while (doneIndexLast.next != null)
    24
    while (doablesLast.next != null)
    Differences
    Expression1Expression2Difference
    doneIndexLastdoablesLastVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doablesLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24
    while (doablesLast.next != null)
    12
    doneIndexLast = doneIndexLast.next;
    12
    doneIndexLast = doneIndexLast.next;
    25
    doablesLast = doablesLast.next;
    Differences
    Expression1Expression2Difference
    doneIndexLastdoablesLastVARIABLE_NAME_MISMATCH
    doneIndexLastdoablesLastVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doablesLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25
    doablesLast = doablesLast.next;
    Precondition Violations (11)
    Row Violation
    1Expression next(input,single) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression next(input,single) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression token.match(input,recurrent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression doablesLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression doablesLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression doablesLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Clone fragment #1 returns variables doneIndex, doneIndexLast , while Clone fragment #2 returns variables doables, doablesLast