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 (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: boolean match(CharIndexed, REMatch) Method name: boolean match(CharIndexed, REMatch)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (results != null) {
1
if (
2
		if (allResult
2
token.match(input, recurrent)) {
3
		    // add all items in current to doables array
3
s == null) {
4
		    if (doables == null) {
4
		    allResults = results;
5
		
5
		    allResultsLast = results;
6
		
6
	doables = recurrent;
7
			doablesLast = recurrent;
7
} else {
8
		    } else {
8
		    // Order these from longest to shortest
9
			// Order these from longest to shortest
9
		    // Start by assuming longest (more repeats)
10
			// Start by assuming longest (more repeats)
10
		    allResultsLast.next = results;
11
			doablesLast.next = re
11
		}
12
		
12
current;
13
		    }
13
// Find new doablesLast
14
		    // Find new doablesLast
14
		while (allResultsLast.next != null) {
15
		    while (doablesLast.next != null) {
15
		    allResultsLast = allResultsLast.next;
16
			doablesLast = doablesLast.next;
16
		}
17
		
17
	    }
18
    }
19
		}
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 in the same method
Number of node comparisons28
  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)7.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    42
    if (allResults == null)
    42
    if (allResults == null)
    20
    if (doables == null)
    Differences
    Expression1Expression2Difference
    allResultsdoablesVARIABLE_NAME_MISMATCH
    20
    if (doables == null)
    43
    allResults = results;
    43
    allResults = results;
    21
    doables = recurrent;
    Differences
    Expression1Expression2Difference
    allResultsdoablesVARIABLE_NAME_MISMATCH
    resultsrecurrentVARIABLE_NAME_MISMATCH
    21
    doables = recurrent;
    44
    allResultsLast = results;
    44
    allResultsLast = results;
    22
    doablesLast = recurrent;
    Differences
    Expression1Expression2Difference
    allResultsLastdoablesLastVARIABLE_NAME_MISMATCH
    resultsrecurrentVARIABLE_NAME_MISMATCH
    22
    doablesLast = recurrent;
    else
    else
    45
    allResultsLast.next = results;
    45
    allResultsLast.next = results;
    23
    doablesLast.next = recurrent;
    Differences
    Expression1Expression2Difference
    allResultsLastdoablesLastVARIABLE_NAME_MISMATCH
    resultsrecurrentVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression allResultsLast.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;
    46
    while (allResultsLast.next != null)
    46
    while (allResultsLast.next != null)
    24
    while (doablesLast.next != null)
    Differences
    Expression1Expression2Difference
    allResultsLastdoablesLastVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression allResultsLast.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)
    47
    allResultsLast = allResultsLast.next;
    47
    allResultsLast = allResultsLast.next;
    25
    doablesLast = doablesLast.next;
    Differences
    Expression1Expression2Difference
    allResultsLastdoablesLastVARIABLE_NAME_MISMATCH
    allResultsLastdoablesLastVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression allResultsLast.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 (7)
    Row Violation
    1Expression allResultsLast.next cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression doablesLast.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 doablesLast.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 doablesLast.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 doables, doablesLast