for (int i = 0; i < instructions.size(); i++) { ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); if (instr instanceof DrawOperation) { PlanarImage img = ((DrawOperation) instr).executeDrawOperation(); graphics.drawImage(img.getAsBufferedImage(), null, 0, 0); } else if (instr instanceof TransformOperation) { graphics = (Graphics2D) bi.getGraphics(); PlanarImage image = ((TransformOperation) instr) .executeTransformOperation(PlanarImage.wrapRenderedImage(bi)); bi = image.getAsBufferedImage(); } } return PlanarImage.wrapRenderedImage(bi);
for (int i = 0; i < instructions.size(); i++) { ImageOperation instr = ((ImageOperation) instructions.elementAt(i)); if (instr instanceof DrawOperation) { PlanarImage img = ((DrawOperation) instr).executeDrawOperation(); graphics.drawImage(img.getAsBufferedImage(), null, 0, 0); } else if (instr instanceof TransformOperation) { graphics = (Graphics2D) bi.getGraphics(); PlanarImage image = ((TransformOperation) instr) .executeTransformOperation(PlanarImage.wrapRenderedImage(bi)); bi = image.getAsBufferedImage(); } } return PlanarImage.wrapRenderedImage(bi);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Arc.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/optional/image/Rectangle.java
Method name: PlanarImage executeDrawOperation() Method name: PlanarImage executeDrawOperation()
Number of AST nodes: 10 Number of AST nodes: 10
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 img = ((DrawOperation) instr).executeDrawOperation();
4
                PlanarImage img = ((DrawOperation) instr).executeDrawOperation();
5
                graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);
5
                graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);
6
            } else if (instr instanceof TransformOperation) {
6
            } else if (instr instanceof TransformOperation) {
7
                graphics = (Graphics2D) bi.getGraphics();
7
                graphics = (Graphics2D) bi.getGraphics();
8
                PlanarImage image
8
                PlanarImage image
9
 = ((TransformOperation) instr)
9
                    = ((TransformOperation) instr)
10
                    .executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
10
                    .executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
11
                bi = image.getAsBufferedImage();
11
                bi = image.getAsBufferedImage();
12
            }
12
            }
13
        }
13
        }
14
        return PlanarImage.wrapRenderedImage(bi);
14
        return PlanarImage.wrapRenderedImage(bi);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.6
Clones locationClones are in different classes having the same super class
Number of node comparisons43
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)21.1
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    11
    for (int i = 0; i < instructions.size(); i++)
    16
    for (int i = 0; i < instructions.size(); i++)
    12
    ImageOperation instr = ((ImageOperation)instructions.elementAt(i));
    17
    ImageOperation instr = ((ImageOperation)instructions.elementAt(i));
    13
    if (instr instanceof DrawOperation)
    18
    if (instr instanceof DrawOperation)
    14
    PlanarImage img = ((DrawOperation)instr).executeDrawOperation();
    19
    PlanarImage img = ((DrawOperation)instr).executeDrawOperation();
    15
    graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);
    20
    graphics.drawImage(img.getAsBufferedImage(), null, 0, 0);
    16
    else if (instr instanceof TransformOperation)
    21
    else if (instr instanceof TransformOperation)
    17
    graphics = (Graphics2D)bi.getGraphics();
    22
    graphics = (Graphics2D)bi.getGraphics();
    18
    PlanarImage image = ((TransformOperation)instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
    23
    PlanarImage image = ((TransformOperation)instr).executeTransformOperation(PlanarImage.wrapRenderedImage(bi));
    19
    bi = image.getAsBufferedImage();
    24
    bi = image.getAsBufferedImage();
    20
    return PlanarImage.wrapRenderedImage(bi);
    25
    return PlanarImage.wrapRenderedImage(bi);
    Precondition Violations (0)
    Row Violation