for (int i = 0; i < instructions.size(); i++) { ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); if (instr instanceof DrawOperation) { // If this TransformOperation has DrawOperation children // then Rotate the first child and return. PlanarImage op = ((DrawOperation) instr).executeDrawOperation(); op = performRotate(op); return op; } } return null;
for (int i = 0; i < instructions.size(); i++) { ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); if (instr instanceof DrawOperation) { PlanarImage image = null; // If this TransformOperation has DrawOperation children // then Rotate the first child and return. performScale(image); return image; } } return null;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Rotate.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Scale.java
Method name: PlanarImage executeDrawOperation() Method name: PlanarImage executeDrawOperation()
Number of AST nodes: 7 Number of AST nodes: 7
1
for (int i = 0; i < instructions.size(); i++) {
1
for (int i = 0; i < instructions.size(); i++) {
2
            ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
2
            ImageOperation instr = ((ImageOperation) instructions.elementAt(i));
3
            if (instr instanceof DrawOperation) {
3
            if (instr instanceof DrawOperation) {
4
                PlanarImage image = null;
4
                // If this TransformOperation has DrawOperation children
5
                // If this TransformOperation has DrawOperation children
5
                // then Rotate the first child and return.
6
                // then Rotate the first child and return.
6
                PlanarImage op = ((DrawOperation) instr).executeDrawOperation();
7
                
7
                op = performRotate(op);
8
performScale(image);
8
                return op;
9
                return image;
9
            }
10
            }
10
        }
11
        }
11
        return null;
12
        return null;
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 in different classes having the same super class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    for (int i = 0; i < instructions.size(); i++)
    1
    for (int i = 0; i < instructions.size(); i++)
    2
    ImageOperation instr = ((ImageOperation)instructions.elementAt(i));
    2
    ImageOperation instr = ((ImageOperation)instructions.elementAt(i));
    3
    if (instr instanceof DrawOperation)
    3
    if (instr instanceof DrawOperation)
    4
    PlanarImage op = ((DrawOperation)instr).executeDrawOperation();
    4
    PlanarImage op = ((DrawOperation)instr).executeDrawOperation();
    4
    PlanarImage image = null;
    Differences
    Expression1Expression2Difference
    opimageVARIABLE_NAME_MISMATCH
    ((DrawOperation)instr).executeDrawOperation()nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ((DrawOperation)instr).executeDrawOperation() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    PlanarImage image = null;
                                                  
    5
    performScale(image);
    Preondition Violations
    Unmatched statement performScale(image); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    performScale(image);
    5
    op = performRotate(op);
    5
    op = performRotate(op);
    Preondition Violations
    Unmatched statement op=performRotate(op); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
    6
    return op;
    6
    return op;
    6
    return image;
    Differences
    Expression1Expression2Difference
    opimageVARIABLE_NAME_MISMATCH
    6
    return image;
    7
    return null;
    7
    return null;
    Precondition Violations (3)
    Row Violation
    1Expression ((DrawOperation)instr).executeDrawOperation() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Unmatched statement performScale(image); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement op=performRotate(op); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted