216-1-2

if (pass == 0 && getItemLineVisible(row, column)) { if (column != 0) { Number previousValue = dataset.getValue(row, column - 1); if (previousValue != null) { // previous data point... double previous = previousValue.doubleValue(); double x0; if (this.useSeriesOffset) { x0 = domainAxis.getCategorySeriesMiddle( dataset.getColumnKey(column - 1), dataset.getRowKey(row), dataset, this.itemMargin, dataArea, plot.getDomainAxisEdge()); } else { x0 = domainAxis.getCategoryMiddle(column - 1, getColumnCount(), dataArea, plot.getDomainAxisEdge()); } double y0 = rangeAxis.valueToJava2D(previous, dataArea, plot.getRangeAxisEdge()); Line2D line = null; if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(y0, x0, y1, x1); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(x0, y0, x1, y1); } g2.setPaint(getItemPaint(row, column)); g2.setStroke(getItemStroke(row, column)); g2.draw(line); } } }
if (getItemLineVisible(row, column)) { if (column != 0) { Number previousValue = statData.getValue(row, column - 1); if (previousValue != null) { // previous data point... double previous = previousValue.doubleValue(); double x0; if (getUseSeriesOffset()) { x0 = domainAxis.getCategorySeriesMiddle( dataset.getColumnKey(column - 1), dataset.getRowKey(row), dataset, getItemMargin(), dataArea, plot.getDomainAxisEdge()); } else { x0 = domainAxis.getCategoryMiddle(column - 1, getColumnCount(), dataArea, plot.getDomainAxisEdge()); } double y0 = rangeAxis.valueToJava2D(previous, dataArea, plot.getRangeAxisEdge()); Line2D line = null; if (orientation == PlotOrientation.HORIZONTAL) { line = new Line2D.Double(y0, x0, y1, x1); } else if (orientation == PlotOrientation.VERTICAL) { line = new Line2D.Double(x0, y0, x1, y1); } g2.setPaint(getItemPaint(row, column)); g2.setStroke(getItemStroke(row, column)); g2.draw(line); } } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LineAndShapeRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StatisticalLineAndShapeRenderer.java
Method name: `void drawItem(Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset, int, int, int)` |  | Method name: `void drawItem(Graphics2D, CategoryItemRendererState, Rectangle2D, CategoryPlot, CategoryAxis, ValueAxis, CategoryDataset, int, int, int)`
Number of AST nodes: 18 |  | Number of AST nodes: 18

1

    if (pass == 0 && getItemLineVisible(row, column)) {↵

1

    if (getItemLineVisible(row, column)) {↵

2

                if (column != 0) {↵

2

                if (column != 0) {↵

3

                    Number previousValue = dataset.getValue(row, column - 1);↵

3

                    Number previousValue = statData.getValue(row, column - 1);↵

4

                    if (previousValue != null) {↵

4

                    if (previousValue != null) {↵

5

                        // previous data point...↵

5

                        // previous data point...↵

6

                        double previous = previousValue.doubleValue();↵

6

                        double previous = previousValue.doubleValue();↵

7

                        double x0;↵

7

                        double x0;↵

8

                        if (this.useSeriesOffset) {↵

8

                        if (getUseSeriesOffset()) {↵

9

                            x0 = domainAxis.getCategorySeriesMiddle(↵

9

                            x0 = domainAxis.getCategorySeriesMiddle(↵

10

                                    dataset.getColumnKey(column - 1),↵

10

                                    dataset.getColumnKey(column - 1),↵

11

                                    dataset.getRowKey(row), dataset,↵

11

                                    dataset.getRowKey(row), dataset,↵

12

                                    this.itemMargin, dataArea,↵

12

                                    getItemMargin(), dataArea,↵

13

                                    plot.getDomainAxisEdge());↵

13

                                    plot.getDomainAxisEdge());↵

14

                        }↵

14

                        }↵

15

                        else {↵

15

                        else {↵

16

                            x0 = domainAxis.getCategoryMiddle(column - 1,↵

16

                            x0 = domainAxis.getCategoryMiddle(column - 1,↵

17

                                    getColumnCount(), dataArea,↵

17

                                    getColumnCount(), dataArea,↵

18

                                    plot.getDomainAxisEdge());↵

18

                                    plot.getDomainAxisEdge());↵

19

                        }↵

19

                        }↵

20

                        double y0 = rangeAxis.valueToJava2D(previous, dataArea,↵

20

                        double y0 = rangeAxis.valueToJava2D(previous, dataArea,↵

21

                                plot.getRangeAxisEdge());↵

21

                                plot.getRangeAxisEdge());↵

22

                        Line2D line = null;↵

22

                        Line2D line = null;↵

23

                        if (orientation == PlotOrientation.HORIZONTAL) {↵

23

                        if (orientation == PlotOrientation.HORIZONTAL) {↵

24

                            line = new Line2D.Double(y0, x0, y1, x1);↵

24

                            line = new Line2D.Double(y0, x0, y1, x1);↵

25

                        }↵

25

                        }↵

26

                        else if (orientation == PlotOrientation.VERTICAL) {↵

26

                        else if (orientation == PlotOrientation.VERTICAL) {↵

27

                            line = new Line2D.Double(x0, y0, x1, y1);↵

27

                            line = new Line2D.Double(x0, y0, x1, y1);↵

28

                        }↵

28

                        }↵

29

                        g2.setPaint(getItemPaint(row, column));↵

29

                        g2.setPaint(getItemPaint(row, column));↵

30

                        g2.setStroke(getItemStroke(row, column));↵

30

                        g2.setStroke(getItemStroke(row, column));↵

31

                        g2.draw(line);↵

31

                        g2.draw(line);↵

32

                    }↵

32

                    }↵

33

                }↵

33

                }↵

34

            }

34

            }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 16.4
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 105

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 17
   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) | 17.4
   Clone type | Type 2

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

   16

       if (column != 0)

   32

       if (column != 0)

   17

       Number previousValue = dataset.getValue(row, column - 1);

   17 | Number previousValue = dataset.getValue(row, column - 1);
   33 | Number previousValue = statData.getValue(row, column - 1);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   dataset | statData | VARIABLE_NAME_MISMATCH
   org.jfree.data.category.CategoryDataset | org.jfree.data.statistics.StatisticalCategoryDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.category.CategoryDataset of variable dataset does not match with type org.jfree.data.statistics.StatisticalCategoryDataset of variable statData
   - Make classes org.jfree.data.category.CategoryDataset and org.jfree.data.statistics.StatisticalCategoryDataset extend a common superclass

   33

       Number previousValue = statData.getValue(row, column - 1);

   18

       if (previousValue != null)

   34

       if (previousValue != null)

   19

       double previous = previousValue.doubleValue();

   35

       double previous = previousValue.doubleValue();

   20

       double x0;

   36

       double x0;

   21

       if (this.useSeriesOffset)

   21 | if (this.useSeriesOffset)
   37 | if (getUseSeriesOffset())

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this |  | MISSING_METHOD_INVOCATION_EXPRESSION
   this.useSeriesOffset | getUseSeriesOffset() | FIELD_ACCESS_REPLACED_WITH_GETTER

   37

       if (getUseSeriesOffset())

   22

       x0 = domainAxis.getCategorySeriesMiddle(dataset.getColumnKey(column - 1), dataset.getRowKey(row), dataset, this.itemMargin, dataArea, plot.getDomainAxisEdge());

   22 | x0 = domainAxis.getCategorySeriesMiddle(dataset.getColumnKey(column - 1), dataset.getRowKey(row), dataset, this.itemMargin, dataArea, plot.getDomainAxisEdge());
   38 | x0 = domainAxis.getCategorySeriesMiddle(dataset.getColumnKey(column - 1), dataset.getRowKey(row), dataset, getItemMargin(), dataArea, plot.getDomainAxisEdge());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this |  | MISSING_METHOD_INVOCATION_EXPRESSION
   this.itemMargin | getItemMargin() | FIELD_ACCESS_REPLACED_WITH_GETTER

   38

       x0 = domainAxis.getCategorySeriesMiddle(dataset.getColumnKey(column - 1), dataset.getRowKey(row), dataset, getItemMargin(), dataArea, plot.getDomainAxisEdge());

       else

       else

   23

       x0 = domainAxis.getCategoryMiddle(column - 1, getColumnCount(), dataArea, plot.getDomainAxisEdge());

   39

       x0 = domainAxis.getCategoryMiddle(column - 1, getColumnCount(), dataArea, plot.getDomainAxisEdge());

   24

       double y0 = rangeAxis.valueToJava2D(previous, dataArea, plot.getRangeAxisEdge());

   40

       double y0 = rangeAxis.valueToJava2D(previous, dataArea, plot.getRangeAxisEdge());

   25

       Line2D line = null;

   41

       Line2D line = null;

   26

       if (orientation == PlotOrientation.HORIZONTAL)

   42

       if (orientation == PlotOrientation.HORIZONTAL)

   27

       line = new Line2D.Double(y0, x0, y1, x1);

   43

       line = new Line2D.Double(y0, x0, y1, x1);

   28

       else if (orientation == PlotOrientation.VERTICAL)

   44

       else if (orientation == PlotOrientation.VERTICAL)

   29

       line = new Line2D.Double(x0, y0, x1, y1);

   45

       line = new Line2D.Double(x0, y0, x1, y1);

   30

       g2.setPaint(getItemPaint(row, column));

   46

       g2.setPaint(getItemPaint(row, column));

   31

       g2.setStroke(getItemStroke(row, column));

   47

       g2.setStroke(getItemStroke(row, column));

   32

       g2.draw(line);

   48

       g2.draw(line);

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Type org.jfree.data.category.CategoryDataset of variable dataset does not match with type org.jfree.data.statistics.StatisticalCategoryDataset of variable statData