for (int i = 0; i < parameters.length; i++) { String paramname = parameters[i].getName(); if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) { setExpression(parameters[i].getValue()); } else { setError("Invalid parameter " + paramname); } }
String paramname = parameters[i].getName(); if (TYPE_KEY.equalsIgnoreCase(paramname)) { FileType t = new FileType(); t.setValue(parameters[i].getValue()); setType(t); } else { setError("Invalid parameter " + paramname); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/ContainsRegexpSelector.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/TypeSelector.java
Method name: void setParameters(Parameter[]) Method name: void setParameters(Parameter[])
Number of AST nodes: 5 Number of AST nodes: 6
1
for (int i = 0; i < parameters.length; i++) {
2
                String paramname = parameters[i].getName();
1
String paramname = parameters[i].getName();
3
                if (EXPRESSION_KEY.equalsIgnoreCase(paramname)) {
2
                if (TYPE_KEY.equalsIgnoreCase(paramname)) {
4
                    setExpression(parameters[i].getValue()
3
                    FileType t = new FileType();
4
                    t.setValue(parameters[i].getValue());
5
);
5
                    setType(t);
6
                } else {
6
                } else {
7
                    setError("Invalid parameter " + paramname);
7
                    setError("Invalid parameter " + paramname);
8
                }
8
                }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    String paramname = parameters[i].getName();
    4
    String paramname = parameters[i].getName();
    5
    if (EXPRESSION_KEY.equalsIgnoreCase(paramname))
    5
    if (EXPRESSION_KEY.equalsIgnoreCase(paramname))
    5
    if (TYPE_KEY.equalsIgnoreCase(paramname))
    Differences
    Expression1Expression2Difference
    EXPRESSION_KEYTYPE_KEYVARIABLE_NAME_MISMATCH
    5
    if (TYPE_KEY.equalsIgnoreCase(paramname))
                                                              
    6
    FileType t = new FileType();
    Preondition Violations
    Unmatched statement FileType t=new FileType(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    FileType t = new FileType();
    6
    setExpression(parameters[i].getValue());
    6
    setExpression(parameters[i].getValue());
    7
    t.setValue(parameters[i].getValue());
    Differences
    Expression1Expression2Difference
    setExpressionsetValueMETHOD_INVOCATION_NAME_MISMATCH
    tMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression setExpression(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    Expression t.setValue(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    Expression setExpression(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    Expression t.setValue(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    7
    t.setValue(parameters[i].getValue());
                                
    8
    setType(t);
    Preondition Violations
    Unmatched statement setType(t); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    setType(t);
    else
    else
    7
    setError("Invalid parameter " + paramname);
    9
    setError("Invalid parameter " + paramname);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement FileType t=new FileType(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Expression setExpression(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    3Expression t.setValue(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    4Expression setExpression(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    5Expression t.setValue(parameters[i].getValue()) is a void method call, and thus it cannot be parameterized
    6Unmatched statement setType(t); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted