Parameter[] params = getParameters(); if (params != null) { for (int i = 0; i < params.length; i++) { if (PREFIX_KEY.equals(params[i].getName())) { prefix = params[i].getValue(); break; } } }
Parameter[] params = getParameters(); if (params != null) { for (int i = 0; i < params.length; i++) { if (COMMENTS_KEY.equals(params[i].getType())) { comments.addElement(params[i].getValue()); } } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/PrefixLines.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/StripLineComments.java
Method name: void initialize() Method name: void initialize()
Number of AST nodes: 6 Number of AST nodes: 5
1
Parameter[] params = getParameters();
1
Parameter[] params = getParameters();
2
        if (params != null) {
2
        if (params != null) {
3
            for (int i = 0; i < params.length; i++) {
3
            for (int i = 0; i < params.length; i++) {
4
                if (PREFIX_KEY.equals(params[i].getName())) {
4
                if (COMMENTS_KEY.equals(params[i].getType())) {
5
                    prefix = params[i].getValue();
5
                    
6
                    break;
6
comments.addElement(params[i].getValue());
7
                }
7
                }
8
            }
8
            }
9
        }
9
        }
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Parameter[] params = getParameters();
    1
    Parameter[] params = getParameters();
    2
    if (params != null)
    2
    if (params != null)
    3
    for (int i = 0; i < params.length; i++)
    3
    for (int i = 0; i < params.length; i++)
    4
    if (PREFIX_KEY.equals(params[i].getName()))
    4
    if (PREFIX_KEY.equals(params[i].getName()))
    4
    if (COMMENTS_KEY.equals(params[i].getType()))
    Differences
    Expression1Expression2Difference
    getNamegetTypeMETHOD_INVOCATION_NAME_MISMATCH
    PREFIX_KEYCOMMENTS_KEYVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression params[i].getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression params[i].getType() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (COMMENTS_KEY.equals(params[i].getType()))
                                                                                              
    5
    comments.addElement(params[i].getValue());
    Preondition Violations
    Unmatched statement comments.addElement(params[i].getValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    comments.addElement(params[i].getValue());
    5
    prefix = params[i].getValue();
    5
    prefix = params[i].getValue();
    Preondition Violations
    Unmatched statement prefix=params[i].getValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                  
    6
    break;
    6
    break;
    Preondition Violations
    Unmatched break;
                      
    Precondition Violations (6)
    Row Violation
    1Expression params[i].getName() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression params[i].getType() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement comments.addElement(params[i].getValue()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement prefix=params[i].getValue(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched break;
    6Clone fragment #1 returns variables params, i , while Clone fragment #2 returns variables params, i