1178-2-3

if (p instanceof GradientPaint) { GradientPaint gp = (GradientPaint) p; GradientPaintTransformer t = im.getGradientPaintTransformer(); if (t != null) { gp = t.transform(gp, rect); } g2.setPaint(gp); } else { g2.setPaint(p); }
if (p instanceof GradientPaint) { GradientPaint gp = (GradientPaint) p; GradientPaintTransformer t = im.getGradientPaintTransformer(); if (t != null) { gp = t.transform(gp, rect); } g2.setPaint(gp); } else { g2.setPaint(p); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/AbstractXYItemRenderer.java
Method name: `void drawDomainMarker(Graphics2D, XYPlot, ValueAxis, Marker, Rectangle2D)` |  | Method name: `void drawRangeMarker(Graphics2D, XYPlot, ValueAxis, Marker, Rectangle2D)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    if (p instanceof GradientPaint) {↵

1

    if (p instanceof GradientPaint) {↵

2

                    GradientPaint gp = (GradientPaint) p;↵

2

                    GradientPaint gp = (GradientPaint) p;↵

3

                    GradientPaintTransformer t = im.getGradientPaintTransformer();↵

3

                    GradientPaintTransformer t = im.getGradientPaintTransformer();↵

4

                    if (t != null) {↵

4

                    if (t != null) {↵

5

                        gp = t.transform(gp, rect);↵

5

                        gp = t.transform(gp, rect);↵

6

                    }↵

6

                    }↵

7

                    g2.setPaint(gp);↵

7

                    g2.setPaint(gp);↵

8

                }↵

8

                }↵

9

                else {↵

9

                else {↵

10

                    g2.setPaint(p);↵

10

                    g2.setPaint(p);↵

11

                }

11

                }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are declared in the same class
Number of node comparisons | 30

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 1.3
   Clone type | Type 1

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   52

       if (p instanceof GradientPaint)

   52

       if (p instanceof GradientPaint)

   53

       GradientPaint gp = (GradientPaint)p;

   53

       GradientPaint gp = (GradientPaint)p;

   54

       GradientPaintTransformer t = im.getGradientPaintTransformer();

   54

       GradientPaintTransformer t = im.getGradientPaintTransformer();

   55

       if (t != null)

   55

       if (t != null)

   56

       gp = t.transform(gp, rect);

   56

       gp = t.transform(gp, rect);

   57

       g2.setPaint(gp);

   57

       g2.setPaint(gp);

       else

       else

   58

       g2.setPaint(p);

   58

       g2.setPaint(p);

   Precondition Violations (0)
   Row | Violation
   --- | ---