for(int i = 0; i < map.length; i++) { Keyword keyword = map[i]; while(keyword != null) { vector.addElement(new String(keyword.keyword)); keyword = keyword.next; } }
for(int i = 0; i < map.map.length; i++) { Keyword k = map.map[i]; while(k != null) { add(k.keyword,k.id); k = k.next; } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/syntax/KeywordMap.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/syntax/KeywordMap.java
Method name: String[] getKeywords() Method name: void add(KeywordMap)
Number of AST nodes: 5 Number of AST nodes: 5
1
for(int i = 0; i < map.length; i++)
1
for(int i = 0; i < map.map.length; i++)
2
		{
2
		{
3
			Keyword keyword = map[i];
3
			Keyword k = map.map[i];
4
			while(keyword != null)
4
			while(k != null)
5
			{
5
			{
6
				vector.addElement(new String(keyword.keyword));
6
				
7
				keyword = keyword
7
add(k.keyword,k.id);
8
.next;
8
				k = k.next;
9
			}
9
			}
10
		}
10
		}
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.3
Clones locationClones are declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    for (int i = 0; i < map.length; i++)
    2
    for (int i = 0; i < map.length; i++)
    1
    for (int i = 0; i < map.map.length; i++)
    Differences
    Expression1Expression2Difference
    mapmap.mapTYPE_COMPATIBLE_REPLACEMENT
    1
    for (int i = 0; i < map.map.length; i++)
    3
    Keyword keyword = map[i];
    3
    Keyword keyword = map[i];
    2
    Keyword k = map.map[i];
    Differences
    Expression1Expression2Difference
    keywordkVARIABLE_NAME_MISMATCH
    mapmap.mapTYPE_COMPATIBLE_REPLACEMENT
    2
    Keyword k = map.map[i];
    4
    while (keyword != null)
    4
    while (keyword != null)
    3
    while (k != null)
    Differences
    Expression1Expression2Difference
    keywordkVARIABLE_NAME_MISMATCH
    3
    while (k != null)
    5
    vector.addElement(new String(keyword.keyword));
    5
    vector.addElement(new String(keyword.keyword));
    4
    add(k.keyword, k.id);
    Differences
    Expression1Expression2Difference
    addElementaddMETHOD_INVOCATION_NAME_MISMATCH
    vector.addElement(new String(keyword.keyword))add(k.keyword,k.id)ARGUMENT_NUMBER_MISMATCH
    vectorMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression vector.addElement(new String(keyword.keyword)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression vector.addElement(new String(keyword.keyword)) is a void method call, and thus it cannot be parameterized
    Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    Expression vector.addElement(new String(keyword.keyword)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression vector.addElement(new String(keyword.keyword)) is a void method call, and thus it cannot be parameterized
    Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    4
    add(k.keyword, k.id);
    6
    keyword = keyword.next;
    6
    keyword = keyword.next;
    5
    k = k.next;
    Differences
    Expression1Expression2Difference
    keywordkVARIABLE_NAME_MISMATCH
    keywordkVARIABLE_NAME_MISMATCH
    5
    k = k.next;
    Precondition Violations (8)
    Row Violation
    1Expression vector.addElement(new String(keyword.keyword)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression vector.addElement(new String(keyword.keyword)) is a void method call, and thus it cannot be parameterized
    4Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized
    5Expression vector.addElement(new String(keyword.keyword)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression add(k.keyword,k.id) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression vector.addElement(new String(keyword.keyword)) is a void method call, and thus it cannot be parameterized
    8Expression add(k.keyword,k.id) is a void method call, and thus it cannot be parameterized