if (axisEdge == RectangleEdge.BOTTOM) { for (int i = 0; i < SUBDIVISIONS; i++) { double v = base + (i * increment); Paint p = this.scale.getPaint(v); double vv = this.axis.valueToJava2D(v, target, RectangleEdge.BOTTOM); r.setRect(vv, target.getMinY(), ww, this.stripWidth); g2.setPaint(p); g2.fill(r); } g2.setPaint(this.stripOutlinePaint); g2.setStroke(this.stripOutlineStroke); g2.draw(new Rectangle2D.Double(target.getMinX(), target.getMinY(), target.getWidth(), this.stripWidth)); this.axis.draw(g2, target.getMinY() + this.stripWidth + this.axisOffset, target, target, RectangleEdge.BOTTOM, null); }
for (int i = 0; i < SUBDIVISIONS; i++) { double v = base + (i * increment); Paint p = this.scale.getPaint(v); double vv = this.axis.valueToJava2D(v, target, RectangleEdge.LEFT); r.setRect(target.getMinX(), vv - hh, this.stripWidth, hh); g2.setPaint(p); g2.fill(r); } g2.setPaint(this.stripOutlinePaint); g2.setStroke(this.stripOutlineStroke); g2.draw(new Rectangle2D.Double(target.getMinX(), target.getMinY(), this.stripWidth, target.getHeight())); this.axis.draw(g2, target.getMinX() + this.stripWidth + this.axisOffset, target, target, RectangleEdge.RIGHT, null);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/title/PaintScaleLegend.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/PaintScaleLegend.java
Method name: Object draw(Graphics2D, Rectangle2D, Object) Method name: Object draw(Graphics2D, Rectangle2D, Object)
Number of AST nodes: 12 Number of AST nodes: 11
1
if (axisEdge == RectangleEdge.BOTTOM) {
2
                for (int i = 0; i < SUBDIVISIONS; i++) {
1
for (int i = 0; i < SUBDIVISIONS; i++) {
3
                    double v = base + (i * increment);
2
                    double v = base + (i * increment);
4
                    Paint p = this.scale.getPaint(v);
3
                    Paint p = this.scale.getPaint(v);
5
                    double vv = this.axis.valueToJava2D(v, target, 
4
                    double vv = this.axis.valueToJava2D(v, target, 
6
                            RectangleEdge.BOTTOM);
5
                            RectangleEdge.LEFT);
7
                    r.setRect(vv, target.getMinY(), ww, this.stripWidth);
6
                    r.setRect(target.getMinX(), vv - hh, this.stripWidth, hh);
8
                    g2.setPaint(p);
7
                    g2.setPaint(p);
9
                    g2.fill(r);
8
                    g2.fill(r);
10
                }
9
                }
11
                g2.setPaint(this.stripOutlinePaint);
10
                g2.setPaint(this.stripOutlinePaint);
12
                g2.setStroke(this.stripOutlineStroke);
11
                g2.setStroke(this.stripOutlineStroke);
13
                g2.draw(new Rectangle2D.Double(target.getMinX(), 
12
                g2.draw(new Rectangle2D.Double(target.getMinX(), 
14
                        target.getMinY(), target.getWidth(), this.stripWidth));
13
                        target.getMinY(), this.stripWidth, target.getHeight()));
15
                this.axis.draw(g2, target.getMinY() + this.stripWidth 
14
                this.axis.draw(g2, target.getMinX() + this.stripWidth 
16
                        + this.axisOffset, target, target, 
15
                        + this.axisOffset, target, target, 
17
                        RectangleEdge.BOTTOM, null);                
18
            }
16
RectangleEdge.RIGHT,
17
                        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.2
Clones locationClones are in the same method
Number of node comparisons66
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)23.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    28
    for (int i = 0; i < SUBDIVISIONS; i++)
    54
    for (int i = 0; i < SUBDIVISIONS; i++)
    29
    double v = base + (i * increment);
    55
    double v = base + (i * increment);
    30
    Paint p = this.scale.getPaint(v);
    56
    Paint p = this.scale.getPaint(v);
    31
    double vv = this.axis.valueToJava2D(v, target, RectangleEdge.BOTTOM);
    31
    double vv = this.axis.valueToJava2D(v, target, RectangleEdge.BOTTOM);
    57
    double vv = this.axis.valueToJava2D(v, target, RectangleEdge.LEFT);
    Differences
    Expression1Expression2Difference
    BOTTOMLEFTVARIABLE_NAME_MISMATCH
    57
    double vv = this.axis.valueToJava2D(v, target, RectangleEdge.LEFT);
    32
    r.setRect(vv, target.getMinY(), ww, this.stripWidth);
    32
    r.setRect(vv, target.getMinY(), ww, this.stripWidth);
    58
    r.setRect(target.getMinX(), vv - hh, this.stripWidth, hh);
    Differences
    Expression1Expression2Difference
    vvtarget.getMinX()TYPE_COMPATIBLE_REPLACEMENT
    target.getMinY()vv - hhTYPE_COMPATIBLE_REPLACEMENT
    wwthis.stripWidthTYPE_COMPATIBLE_REPLACEMENT
    this.stripWidthhhTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression vv cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression vv - hh cannot be parameterized, because it has dependencies to/from statements that will be extracted
    58
    r.setRect(target.getMinX(), vv - hh, this.stripWidth, hh);
    33
    g2.setPaint(p);
    59
    g2.setPaint(p);
    34
    g2.fill(r);
    60
    g2.fill(r);
    35
    g2.setPaint(this.stripOutlinePaint);
    61
    g2.setPaint(this.stripOutlinePaint);
    36
    g2.setStroke(this.stripOutlineStroke);
    62
    g2.setStroke(this.stripOutlineStroke);
    37
    g2.draw(new Rectangle2D.Double(target.getMinX(), target.getMinY(), target.getWidth(), this.stripWidth));
    37
    g2.draw(new Rectangle2D.Double(target.getMinX(), target.getMinY(), target.getWidth(), this.stripWidth));
    63
    g2.draw(new Rectangle2D.Double(target.getMinX(), target.getMinY(), this.stripWidth, target.getHeight()));
    Differences
    Expression1Expression2Difference
    target.getWidth()this.stripWidthTYPE_COMPATIBLE_REPLACEMENT
    this.stripWidthtarget.getHeight()TYPE_COMPATIBLE_REPLACEMENT
    63
    g2.draw(new Rectangle2D.Double(target.getMinX(), target.getMinY(), this.stripWidth, target.getHeight()));
    38
    this.axis.draw(g2, target.getMinY() + this.stripWidth + this.axisOffset, target, target, RectangleEdge.BOTTOM, null);
    38
    this.axis.draw(g2, target.getMinY() + this.stripWidth + this.axisOffset, target, target, RectangleEdge.BOTTOM, null);
    64
    this.axis.draw(g2, target.getMinX() + this.stripWidth + this.axisOffset, target, target, RectangleEdge.RIGHT, null);
    Differences
    Expression1Expression2Difference
    getMinYgetMinXMETHOD_INVOCATION_NAME_MISMATCH
    BOTTOMRIGHTVARIABLE_NAME_MISMATCH
    64
    this.axis.draw(g2, target.getMinX() + this.stripWidth + this.axisOffset, target, target, RectangleEdge.RIGHT, null);
    Precondition Violations (2)
    Row Violation
    1Expression vv cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression vv - hh cannot be parameterized, because it has dependencies to/from statements that will be extracted