if (results != null) { if (allResults == null) { allResults = results; allResultsLast = results; } else { // Order these from longest to shortest // Start by assuming longest (more repeats) allResultsLast.next = results; } // Find new doablesLast while (allResultsLast.next != null) { allResultsLast = allResultsLast.next; } }
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: 7 Number of AST nodes: 7
1
if (results != null) {
1
if (
2
		if (allResults
2
next(input, single)) {
3
		// chain results to doneIndex
3
 == null) {
4
		if (doneIndex == null) {
4
		    allResults = results;
5
		    
5
		    allResultsLast = results;
6
		} else {
7
		    // Order these from longest to shortest
8
		    // Start by assuming longest (more repeats)
9
		    allResults
6
doneIndex = single;
7
		    doneIndexLast = single;
8
		} else {
10
Last.next = results;
9
		    doneIndexLast.next = single;
11
		}
10
		}
12
		// Find new doablesLast
11
		// Find new doneIndexLast
13
		while (allResultsLast.next != null) {
12
		while (doneIndexLast.next != null) {
14
		    allResultsLast = allResultsLast.next;
13
		    doneIndexLast = doneIndexLast.next;
15
		}
14
		}
16
	    }
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.7
Clones locationClones are declared in the same class
Number of node comparisons26
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    42
    if (allResults == null)
    42
    if (allResults == null)
    7
    if (doneIndex == null)
    Differences
    Expression1Expression2Difference
    allResultsdoneIndexVARIABLE_NAME_MISMATCH
    7
    if (doneIndex == null)
    43
    allResults = results;
    43
    allResults = results;
    8
    doneIndex = single;
    Differences
    Expression1Expression2Difference
    allResultsdoneIndexVARIABLE_NAME_MISMATCH
    resultssingleVARIABLE_NAME_MISMATCH
    8
    doneIndex = single;
    44
    allResultsLast = results;
    44
    allResultsLast = results;
    9
    doneIndexLast = single;
    Differences
    Expression1Expression2Difference
    allResultsLastdoneIndexLastVARIABLE_NAME_MISMATCH
    resultssingleVARIABLE_NAME_MISMATCH
    9
    doneIndexLast = single;
    else
    else
    45
    allResultsLast.next = results;
    45
    allResultsLast.next = results;
    10
    doneIndexLast.next = single;
    Differences
    Expression1Expression2Difference
    allResultsLastdoneIndexLastVARIABLE_NAME_MISMATCH
    resultssingleVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    doneIndexLast.next = single;
    46
    while (allResultsLast.next != null)
    46
    while (allResultsLast.next != null)
    11
    while (doneIndexLast.next != null)
    Differences
    Expression1Expression2Difference
    allResultsLastdoneIndexLastVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11
    while (doneIndexLast.next != null)
    47
    allResultsLast = allResultsLast.next;
    47
    allResultsLast = allResultsLast.next;
    12
    doneIndexLast = doneIndexLast.next;
    Differences
    Expression1Expression2Difference
    allResultsLastdoneIndexLastVARIABLE_NAME_MISMATCH
    allResultsLastdoneIndexLastVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    doneIndexLast = doneIndexLast.next;
    Precondition Violations (7)
    Row Violation
    1Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression doneIndexLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Clone fragment #1 returns variables allResults, allResultsLast , while Clone fragment #2 returns variables doneIndex, doneIndexLast