300-1-3

if (orientation == PlotOrientation.VERTICAL) { Line2D line = new Line2D.Double(); double x0 = dataArea.getMinX(); double x1 = dataArea.getMaxX(); g2.setPaint(im.getOutlinePaint()); g2.setStroke(im.getOutlineStroke()); if (range.contains(start)) { line.setLine(x0, start2d, x1, start2d); g2.draw(line); } if (range.contains(end)) { line.setLine(x0, end2d, x1, end2d); g2.draw(line); } } else { // PlotOrientation.HORIZONTAL Line2D line = new Line2D.Double(); double y0 = dataArea.getMinY(); double y1 = dataArea.getMaxY(); g2.setPaint(im.getOutlinePaint()); g2.setStroke(im.getOutlineStroke()); if (range.contains(start)) { line.setLine(start2d, y0, start2d, y1); g2.draw(line); } if (range.contains(end)) { line.setLine(end2d, y0, end2d, y1); g2.draw(line); } }
if (orientation == PlotOrientation.VERTICAL) { Line2D line = new Line2D.Double(); double x0 = dataArea.getMinX(); double x1 = dataArea.getMaxX(); g2.setPaint(im.getOutlinePaint()); g2.setStroke(im.getOutlineStroke()); if (range.contains(start)) { line.setLine(x0, start2d, x1, start2d); g2.draw(line); } if (range.contains(end)) { line.setLine(x0, end2d, x1, end2d); g2.draw(line); } } else { // PlotOrientation.HORIZONTAL Line2D line = new Line2D.Double(); double y0 = dataArea.getMinY(); double y1 = dataArea.getMaxY(); g2.setPaint(im.getOutlinePaint()); g2.setStroke(im.getOutlineStroke()); if (range.contains(start)) { line.setLine(start2d, y0, start2d, y1); g2.draw(line); } if (range.contains(end)) { line.setLine(end2d, y0, end2d, y1); g2.draw(line); } }

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

1

    if (orientation == PlotOrientation.VERTICAL) {↵

1

    if (orientation == PlotOrientation.VERTICAL) {↵

2

                        Line2D line = new Line2D.Double();↵

2

                        Line2D line = new Line2D.Double();↵

3

                        double x0 = dataArea.getMinX();↵

3

                        double x0 = dataArea.getMinX();↵

4

                        double x1 = dataArea.getMaxX();↵

4

                        double x1 = dataArea.getMaxX();↵

5

                        g2.setPaint(im.getOutlinePaint());↵

5

                        g2.setPaint(im.getOutlinePaint());↵

6

                        g2.setStroke(im.getOutlineStroke());↵

6

                        g2.setStroke(im.getOutlineStroke());↵

7

                        if (range.contains(start)) {↵

7

                        if (range.contains(start)) {↵

8

                            line.setLine(x0, start2d, x1, start2d);↵

8

                            line.setLine(x0, start2d, x1, start2d);↵

9

                            g2.draw(line);↵

9

                            g2.draw(line);↵

10

                        }↵

10

                        }↵

11

                        if (range.contains(end)) {↵

11

                        if (range.contains(end)) {↵

12

                            line.setLine(x0, end2d, x1, end2d);↵

12

                            line.setLine(x0, end2d, x1, end2d);↵

13

                            g2.draw(line);↵

13

                            g2.draw(line);↵

14

                        }↵

14

                        }↵

15

                    }↵

15

                    }↵

16

                    else { // PlotOrientation.HORIZONTAL↵

16

                    else { // PlotOrientation.HORIZONTAL↵

17

                        Line2D line = new Line2D.Double();↵

17

                        Line2D line = new Line2D.Double();↵

18

                        double y0 = dataArea.getMinY();↵

18

                        double y0 = dataArea.getMinY();↵

19

                        double y1 = dataArea.getMaxY();↵

19

                        double y1 = dataArea.getMaxY();↵

20

                        g2.setPaint(im.getOutlinePaint());↵

20

                        g2.setPaint(im.getOutlinePaint());↵

21

                        g2.setStroke(im.getOutlineStroke());↵

21

                        g2.setStroke(im.getOutlineStroke());↵

22

                        if (range.contains(start)) {↵

22

                        if (range.contains(start)) {↵

23

                            line.setLine(start2d, y0, start2d, y1);↵

23

                            line.setLine(start2d, y0, start2d, y1);↵

24

                            g2.draw(line);↵

24

                            g2.draw(line);↵

25

                        }↵

25

                        }↵

26

                        if (range.contains(end)) {↵

26

                        if (range.contains(end)) {↵

27

                            line.setLine(end2d, y0, end2d, y1);↵

27

                            line.setLine(end2d, y0, end2d, y1);↵

28

                            g2.draw(line);↵

28

                            g2.draw(line);↵

29

                        }↵

29

                        }↵

30

                    }

30

                    }

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) | 1.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 202

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 23
   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) | 8.4
   Clone type | Type 1

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

   61

       if (orientation == PlotOrientation.VERTICAL)

   61

       if (orientation == PlotOrientation.VERTICAL)

   62

       Line2D line = new Line2D.Double();

   62

       Line2D line = new Line2D.Double();

   63

       double x0 = dataArea.getMinX();

   63

       double x0 = dataArea.getMinX();

   64

       double x1 = dataArea.getMaxX();

   64

       double x1 = dataArea.getMaxX();

   65

       g2.setPaint(im.getOutlinePaint());

   65

       g2.setPaint(im.getOutlinePaint());

   66

       g2.setStroke(im.getOutlineStroke());

   66

       g2.setStroke(im.getOutlineStroke());

   67

       if (range.contains(start))

   67

       if (range.contains(start))

   68

       line.setLine(x0, start2d, x1, start2d);

   68

       line.setLine(x0, start2d, x1, start2d);

   69

       g2.draw(line);

   69

       g2.draw(line);

   70

       if (range.contains(end))

   70

       if (range.contains(end))

   71

       line.setLine(x0, end2d, x1, end2d);

   71

       line.setLine(x0, end2d, x1, end2d);

   72

       g2.draw(line);

   72

       g2.draw(line);

       else

       else

   73

       Line2D line = new Line2D.Double();

   73

       Line2D line = new Line2D.Double();

   74

       double y0 = dataArea.getMinY();

   74

       double y0 = dataArea.getMinY();

   75

       double y1 = dataArea.getMaxY();

   75

       double y1 = dataArea.getMaxY();

   76

       g2.setPaint(im.getOutlinePaint());

   76

       g2.setPaint(im.getOutlinePaint());

   77

       g2.setStroke(im.getOutlineStroke());

   77

       g2.setStroke(im.getOutlineStroke());

   78

       if (range.contains(start))

   78

       if (range.contains(start))

   79

       line.setLine(start2d, y0, start2d, y1);

   79

       line.setLine(start2d, y0, start2d, y1);

   80

       g2.draw(line);

   80

       g2.draw(line);

   81

       if (range.contains(end))

   81

       if (range.contains(end))

   82

       line.setLine(end2d, y0, end2d, y1);

   82

       line.setLine(end2d, y0, end2d, y1);

   83

       g2.draw(line);

   83

       g2.draw(line);

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