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