while (--posIndex >= min) { newMatch = (REMatch) positions.elementAt(posIndex); results = matchRest(input, newMatch); 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; } } // else did not match rest of the tokens, try again on smaller sample }
for (current = newMatch; current != null; current = current.next) { 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; } } }
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: 10 Number of AST nodes: 9
1
while (--posIndex >= min) {
2
	    newMatch = (REMatch) positions.elementAt(posIndex);
3
	    results = 
1
for (current = newMatch; current != null; current = current.next) {
2
		recurrent = (REMatch) current.clone();
4
matchRest(input, newMatch);
3
		if (token.match(input, 
5
	    if (results != null) {
6
		if (allResult
4
recurrent)) {
5
		    // add all items in current to doables array
7
s == null) {
6
		    if (doables == null) {
8
		    allResults = results;
7
		
9
		    allResultsLast = results;
10
		
8
	doables = recurrent;
9
			doablesLast = recurrent;
11
} else {
10
		    } else {
12
		    // Order these from longest to shortest
11
			// Order these from longest to shortest
13
		    // Start by assuming longest (more repeats)
12
			// Start by assuming longest (more repeats)
14
		    allResultsLast.next = results;
13
		
15
		}
16
		
14
	doablesLast.next = recurrent;
15
		    }
17
// Find new doablesLast
16
		    // Find new doablesLast
18
		while (allResultsLast.next != null) {
17
		    while (doablesLast.next != null) {
19
		    allResultsLast = allResultsLast.next;
18
			doablesLast = doablesLast.next;
20
		}
19
		
21
	    }
20
    }
22
	
21
		}
23
    // else did not match rest of the tokens, try again on smaller sample
22
	    
24
	}
23
}
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)1.1
Clones locationClones are in the same method
Number of node comparisons35
  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)4.1
    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
    23
    doablesLast.next = recurrent;
    46
    while (allResultsLast.next != null)
    46
    while (allResultsLast.next != null)
    24
    while (doablesLast.next != null)
    Differences
    Expression1Expression2Difference
    allResultsLastdoablesLastVARIABLE_NAME_MISMATCH
    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
    25
    doablesLast = doablesLast.next;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables allResults, allResultsLast , while Clone fragment #2 returns variables doables, doablesLast