float x0 = (float) dataArea.getX(); float x1 = x0 + (float) Math.abs(this.xOffset); float x3 = (float) dataArea.getMaxX(); float x2 = x3 - (float) Math.abs(this.xOffset); float y0 = (float) dataArea.getMaxY(); float y1 = y0 - (float) Math.abs(this.yOffset); float y3 = (float) dataArea.getMinY(); float y2 = y3 + (float) Math.abs(this.yOffset); GeneralPath clip = new GeneralPath(); clip.moveTo(x0, y0); clip.lineTo(x0, y2); clip.lineTo(x1, y3); clip.lineTo(x3, y3); clip.lineTo(x3, y1); clip.lineTo(x2, y0); clip.closePath(); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, plot.getBackgroundAlpha())); // fill background... Paint backgroundPaint = plot.getBackgroundPaint(); if (backgroundPaint != null) { g2.setPaint(backgroundPaint); g2.fill(clip); } GeneralPath leftWall = new GeneralPath(); leftWall.moveTo(x0, y0); leftWall.lineTo(x0, y2); leftWall.lineTo(x1, y3); leftWall.lineTo(x1, y1); leftWall.closePath(); g2.setPaint(getWallPaint()); g2.fill(leftWall); GeneralPath bottomWall = new GeneralPath(); bottomWall.moveTo(x0, y0); bottomWall.lineTo(x1, y1); bottomWall.lineTo(x3, y1); bottomWall.lineTo(x2, y0); bottomWall.closePath(); g2.setPaint(getWallPaint()); g2.fill(bottomWall); // highlight the background corners... g2.setPaint(Color.lightGray); Line2D corner = new Line2D.Double(x0, y0, x1, y1); g2.draw(corner); corner.setLine(x1, y1, x1, y3); g2.draw(corner); corner.setLine(x1, y1, x3, y1); g2.draw(corner); // draw background image, if there is one... Image backgroundImage = plot.getBackgroundImage(); if (backgroundImage != null) { Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() + getXOffset(), dataArea.getY(), dataArea.getWidth() - getXOffset(), dataArea.getHeight() - getYOffset()); plot.drawBackgroundImage(g2, adjusted); } g2.setComposite(originalComposite);
float x0 = (float) dataArea.getX(); float x1 = x0 + (float) Math.abs(this.xOffset); float x3 = (float) dataArea.getMaxX(); float x2 = x3 - (float) Math.abs(this.xOffset); float y0 = (float) dataArea.getMaxY(); float y1 = y0 - (float) Math.abs(this.yOffset); float y3 = (float) dataArea.getMinY(); float y2 = y3 + (float) Math.abs(this.yOffset); GeneralPath clip = new GeneralPath(); clip.moveTo(x0, y0); clip.lineTo(x0, y2); clip.lineTo(x1, y3); clip.lineTo(x3, y3); clip.lineTo(x3, y1); clip.lineTo(x2, y0); clip.closePath(); Composite originalComposite = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, plot.getBackgroundAlpha())); // fill background... Paint backgroundPaint = plot.getBackgroundPaint(); if (backgroundPaint != null) { g2.setPaint(backgroundPaint); g2.fill(clip); } GeneralPath leftWall = new GeneralPath(); leftWall.moveTo(x0, y0); leftWall.lineTo(x0, y2); leftWall.lineTo(x1, y3); leftWall.lineTo(x1, y1); leftWall.closePath(); g2.setPaint(getWallPaint()); g2.fill(leftWall); GeneralPath bottomWall = new GeneralPath(); bottomWall.moveTo(x0, y0); bottomWall.lineTo(x1, y1); bottomWall.lineTo(x3, y1); bottomWall.lineTo(x2, y0); bottomWall.closePath(); g2.setPaint(getWallPaint()); g2.fill(bottomWall); // higlight the background corners... g2.setPaint(Color.lightGray); Line2D corner = new Line2D.Double(x0, y0, x1, y1); g2.draw(corner); corner.setLine(x1, y1, x1, y3); g2.draw(corner); corner.setLine(x1, y1, x3, y1); g2.draw(corner); // draw background image, if there is one... Image backgroundImage = plot.getBackgroundImage(); if (backgroundImage != null) { Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() + getXOffset(), dataArea.getY(), dataArea.getWidth() - getXOffset(), dataArea.getHeight() - getYOffset()); plot.drawBackgroundImage(g2, adjusted); } g2.setComposite(originalComposite);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/BarRenderer3D.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LineRenderer3D.java
Method name: void drawBackground(Graphics2D, CategoryPlot, Rectangle2D) Method name: void drawBackground(Graphics2D, CategoryPlot, Rectangle2D)
Number of AST nodes: 50 Number of AST nodes: 50
1
float x0 = (float) dataArea.getX();
1
float x0 = (float) dataArea.getX();
2
        float x1 = x0 + (float) Math.abs(this.xOffset);
2
        float x1 = x0 + (float) Math.abs(this.xOffset);
3
        float x3 = (float) dataArea.getMaxX();
3
        float x3 = (float) dataArea.getMaxX();
4
        float x2 = x3 - (float) Math.abs(this.xOffset);
4
        float x2 = x3 - (float) Math.abs(this.xOffset);
5
        float y0 = (float) dataArea.getMaxY();
5
        float y0 = (float) dataArea.getMaxY();
6
        float y1 = y0 - (float) Math.abs(this.yOffset);
6
        float y1 = y0 - (float) Math.abs(this.yOffset);
7
        float y3 = (float) dataArea.getMinY();
7
        float y3 = (float) dataArea.getMinY();
8
        float y2 = y3 + (float) Math.abs(this.yOffset);
8
        float y2 = y3 + (float) Math.abs(this.yOffset);
9
        GeneralPath clip = new GeneralPath();
9
        GeneralPath clip = new GeneralPath();
10
        clip.moveTo(x0, y0);
10
        clip.moveTo(x0, y0);
11
        clip.lineTo(x0, y2);
11
        clip.lineTo(x0, y2);
12
        clip.lineTo(x1, y3);
12
        clip.lineTo(x1, y3);
13
        clip.lineTo(x3, y3);
13
        clip.lineTo(x3, y3);
14
        clip.lineTo(x3, y1);
14
        clip.lineTo(x3, y1);
15
        clip.lineTo(x2, y0);
15
        clip.lineTo(x2, y0);
16
        clip.closePath();
16
        clip.closePath();
17
        Composite originalComposite = g2.getComposite();
17
        Composite originalComposite = g2.getComposite();
18
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
18
        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
19
                plot.getBackgroundAlpha()));
19
                plot.getBackgroundAlpha()));
20
        // fill background...
20
        // fill background...
21
        Paint backgroundPaint = plot.getBackgroundPaint();
21
        Paint backgroundPaint = plot.getBackgroundPaint();
22
        if (backgroundPaint != null) {
22
        if (backgroundPaint != null) {
23
            g2.setPaint(backgroundPaint);
23
            g2.setPaint(backgroundPaint);
24
            g2.fill(clip);
24
            g2.fill(clip);
25
        }
25
        }
26
        GeneralPath leftWall = new GeneralPath();
26
        GeneralPath leftWall = new GeneralPath();
27
        leftWall.moveTo(x0, y0);
27
        leftWall.moveTo(x0, y0);
28
        leftWall.lineTo(x0, y2);
28
        leftWall.lineTo(x0, y2);
29
        leftWall.lineTo(x1, y3);
29
        leftWall.lineTo(x1, y3);
30
        leftWall.lineTo(x1, y1);
30
        leftWall.lineTo(x1, y1);
31
        leftWall.closePath();
31
        leftWall.closePath();
32
        g2.setPaint(getWallPaint());
32
        g2.setPaint(getWallPaint());
33
        g2.fill(leftWall);
33
        g2.fill(leftWall);
34
        GeneralPath bottomWall = new GeneralPath();
34
        GeneralPath bottomWall = new GeneralPath();
35
        bottomWall.moveTo(x0, y0);
35
        bottomWall.moveTo(x0, y0);
36
        bottomWall.lineTo(x1, y1);
36
        bottomWall.lineTo(x1, y1);
37
        bottomWall.lineTo(x3, y1);
37
        bottomWall.lineTo(x3, y1);
38
        bottomWall.lineTo(x2, y0);
38
        bottomWall.lineTo(x2, y0);
39
        bottomWall.closePath();
39
        bottomWall.closePath();
40
        g2.setPaint(getWallPaint());
40
        g2.setPaint(getWallPaint());
41
        g2.fill(bottomWall);
41
        g2.fill(bottomWall);
42
        // highlight the background corners...
42
        // higlight the background corners...
43
        g2.setPaint(Color.lightGray);
43
        g2.setPaint(Color.lightGray);
44
        Line2D corner = new Line2D.Double(x0, y0, x1, y1);
44
        Line2D corner = new Line2D.Double(x0, y0, x1, y1);
45
        g2.draw(corner);
45
        g2.draw(corner);
46
        corner.setLine(x1, y1, x1, y3);
46
        corner.setLine(x1, y1, x1, y3);
47
        g2.draw(corner);
47
        g2.draw(corner);
48
        corner.setLine(x1, y1, x3, y1);
48
        corner.setLine(x1, y1, x3, y1);
49
        g2.draw(corner);
49
        g2.draw(corner);
50
        // draw background image, if there is one...
50
        // draw background image, if there is one...
51
        Image backgroundImage = plot.getBackgroundImage();
51
        Image backgroundImage = plot.getBackgroundImage();
52
        if (backgroundImage != null) {
52
        if (backgroundImage != null) {
53
            Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
53
            Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX()
54
                    + getXOffset(), dataArea.getY(),
54
                    + getXOffset(), dataArea.getY(),
55
                    dataArea.getWidth() - getXOffset(),
55
                    dataArea.getWidth() - getXOffset(),
56
                    dataArea.getHeight() - getYOffset());
56
                    dataArea.getHeight() - getYOffset());
57
            plot.drawBackgroundImage(g2, adjusted);
57
            plot.drawBackgroundImage(g2, adjusted);
58
        }
58
        }
59
        g2.setComposite(originalComposite);
59
        g2.setComposite(originalComposite);
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons634
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements50
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)135.6
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    1
    float x0 = (float)dataArea.getX();
    1
    float x0 = (float)dataArea.getX();
    2
    float x1 = x0 + (float)Math.abs(this.xOffset);
    2
    float x1 = x0 + (float)Math.abs(this.xOffset);
    3
    float x3 = (float)dataArea.getMaxX();
    3
    float x3 = (float)dataArea.getMaxX();
    4
    float x2 = x3 - (float)Math.abs(this.xOffset);
    4
    float x2 = x3 - (float)Math.abs(this.xOffset);
    5
    float y0 = (float)dataArea.getMaxY();
    5
    float y0 = (float)dataArea.getMaxY();
    6
    float y1 = y0 - (float)Math.abs(this.yOffset);
    6
    float y1 = y0 - (float)Math.abs(this.yOffset);
    7
    float y3 = (float)dataArea.getMinY();
    7
    float y3 = (float)dataArea.getMinY();
    8
    float y2 = y3 + (float)Math.abs(this.yOffset);
    8
    float y2 = y3 + (float)Math.abs(this.yOffset);
    9
    GeneralPath clip = new GeneralPath();
    9
    GeneralPath clip = new GeneralPath();
    10
    clip.moveTo(x0, y0);
    10
    clip.moveTo(x0, y0);
    11
    clip.lineTo(x0, y2);
    11
    clip.lineTo(x0, y2);
    12
    clip.lineTo(x1, y3);
    12
    clip.lineTo(x1, y3);
    13
    clip.lineTo(x3, y3);
    13
    clip.lineTo(x3, y3);
    14
    clip.lineTo(x3, y1);
    14
    clip.lineTo(x3, y1);
    15
    clip.lineTo(x2, y0);
    15
    clip.lineTo(x2, y0);
    16
    clip.closePath();
    16
    clip.closePath();
    17
    Composite originalComposite = g2.getComposite();
    17
    Composite originalComposite = g2.getComposite();
    18
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, plot.getBackgroundAlpha()));
    18
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, plot.getBackgroundAlpha()));
    19
    Paint backgroundPaint = plot.getBackgroundPaint();
    19
    Paint backgroundPaint = plot.getBackgroundPaint();
    20
    if (backgroundPaint != null)
    20
    if (backgroundPaint != null)
    21
    g2.setPaint(backgroundPaint);
    21
    g2.setPaint(backgroundPaint);
    22
    g2.fill(clip);
    22
    g2.fill(clip);
    23
    GeneralPath leftWall = new GeneralPath();
    23
    GeneralPath leftWall = new GeneralPath();
    24
    leftWall.moveTo(x0, y0);
    24
    leftWall.moveTo(x0, y0);
    25
    leftWall.lineTo(x0, y2);
    25
    leftWall.lineTo(x0, y2);
    26
    leftWall.lineTo(x1, y3);
    26
    leftWall.lineTo(x1, y3);
    27
    leftWall.lineTo(x1, y1);
    27
    leftWall.lineTo(x1, y1);
    28
    leftWall.closePath();
    28
    leftWall.closePath();
    29
    g2.setPaint(getWallPaint());
    29
    g2.setPaint(getWallPaint());
    30
    g2.fill(leftWall);
    30
    g2.fill(leftWall);
    31
    GeneralPath bottomWall = new GeneralPath();
    31
    GeneralPath bottomWall = new GeneralPath();
    32
    bottomWall.moveTo(x0, y0);
    32
    bottomWall.moveTo(x0, y0);
    33
    bottomWall.lineTo(x1, y1);
    33
    bottomWall.lineTo(x1, y1);
    34
    bottomWall.lineTo(x3, y1);
    34
    bottomWall.lineTo(x3, y1);
    35
    bottomWall.lineTo(x2, y0);
    35
    bottomWall.lineTo(x2, y0);
    36
    bottomWall.closePath();
    36
    bottomWall.closePath();
    37
    g2.setPaint(getWallPaint());
    37
    g2.setPaint(getWallPaint());
    38
    g2.fill(bottomWall);
    38
    g2.fill(bottomWall);
    39
    g2.setPaint(Color.lightGray);
    39
    g2.setPaint(Color.lightGray);
    40
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    40
    Line2D corner = new Line2D.Double(x0, y0, x1, y1);
    41
    g2.draw(corner);
    41
    g2.draw(corner);
    42
    corner.setLine(x1, y1, x1, y3);
    42
    corner.setLine(x1, y1, x1, y3);
    43
    g2.draw(corner);
    43
    g2.draw(corner);
    44
    corner.setLine(x1, y1, x3, y1);
    44
    corner.setLine(x1, y1, x3, y1);
    45
    g2.draw(corner);
    45
    g2.draw(corner);
    46
    Image backgroundImage = plot.getBackgroundImage();
    46
    Image backgroundImage = plot.getBackgroundImage();
    47
    if (backgroundImage != null)
    47
    if (backgroundImage != null)
    48
    Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() + getXOffset(), dataArea.getY(), dataArea.getWidth() - getXOffset(), dataArea.getHeight() - getYOffset());
    48
    Rectangle2D adjusted = new Rectangle2D.Double(dataArea.getX() + getXOffset(), dataArea.getY(), dataArea.getWidth() - getXOffset(), dataArea.getHeight() - getYOffset());
    49
    plot.drawBackgroundImage(g2, adjusted);
    49
    plot.drawBackgroundImage(g2, adjusted);
    50
    g2.setComposite(originalComposite);
    50
    g2.setComposite(originalComposite);
    Precondition Violations (0)
    Row Violation