330-1-2

if (getItemVisible(series, 0)) { String label = getLegendItemLabelGenerator().generateLabel( dataset, series); String description = label; String toolTipText = null; if (getLegendItemToolTipGenerator() != null) { toolTipText = getLegendItemToolTipGenerator().generateLabel( dataset, series); } String urlText = null; if (getLegendItemURLGenerator() != null) { urlText = getLegendItemURLGenerator().generateLabel( dataset, series); } Shape shape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0); Paint paint = lookupSeriesPaint(series); Paint outlinePaint = lookupSeriesOutlinePaint(series); Stroke outlineStroke = lookupSeriesOutlineStroke(series); result = new LegendItem(label, description, toolTipText, urlText, shape, paint, outlineStroke, outlinePaint); result.setDataset(dataset); result.setDatasetIndex(datasetIndex); result.setSeriesKey(dataset.getSeriesKey(series)); result.setSeriesIndex(series); }
if (dataset != null) { if (getItemVisible(series, 0)) { String label = getLegendItemLabelGenerator().generateLabel( dataset, series); String description = label; String toolTipText = null; if (getLegendItemToolTipGenerator() != null) { toolTipText = getLegendItemToolTipGenerator().generateLabel( dataset, series); } String urlText = null; if (getLegendItemURLGenerator() != null) { urlText = getLegendItemURLGenerator().generateLabel( dataset, series); } Paint paint = lookupSeriesPaint(series); Stroke stroke = lookupSeriesStroke(series); // TODO: the following hard-coded line needs generalising Line2D line = new Line2D.Double(-7.0, 0.0, 7.0, 0.0); result = new LegendItem(label, description, toolTipText, urlText, line, stroke, paint); result.setDataset(dataset); result.setDatasetIndex(datasetIndex); result.setSeriesKey(dataset.getSeriesKey(series)); result.setSeriesIndex(series); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBubbleRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYDifferenceRenderer.java
Method name: `LegendItem getLegendItem(int, int)` |  | Method name: `LegendItem getLegendItem(int, int)`
Number of AST nodes: 18 |  | Number of AST nodes: 18

1

    if (dataset != null) {↵

1

    if (getItemVisible(series, 0)) {↵

2

                    if (getItemVisible(series, 0)) {↵

2

                    String label = getLegendItemLabelGenerator().generateLabel(↵

3

                        String label = getLegendItemLabelGenerator().generateLabel(↵

3

                            dataset, series);↵

4

                                dataset, series);↵

4

                    String description = label;↵

5

                        String description = label;↵

5

                    String toolTipText = null;↵

6

                        String toolTipText = null;↵

6

                    if (getLegendItemToolTipGenerator() != null) {↵

7

                        if (getLegendItemToolTipGenerator() != null) {↵

7

                        toolTipText ↵

8

                            toolTipText ↵

8

    = getLegendItemToolTipGenerator().generateLabel(↵

9

                                = getLegendItemToolTipGenerator().generateLabel(↵

9

                                dataset, series);↵

10

                                        dataset, series);↵

10

                    }↵

11

                        }↵

11

                    String urlText = null;↵

12

                        String urlText = null;↵

12

                    if (getLegendItemURLGenerator() != null) {↵

13

                        if (getLegendItemURLGenerator() != null) {↵

13

                        urlText = getLegendItemURLGenerator().generateLabel(↵

14

                            urlText = getLegendItemURLGenerator().generateLabel(↵

14

                                dataset, series);↵

15

                                    dataset, series);↵

15

                    }↵

16

                        }↵

16

                    Shape shape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0);↵

17

        ↵

17

                    Paint paint = lookupSeriesPaint(series);↵

18

                    Paint paint = lookupSeriesPaint(series);↵

18

                    Paint outlinePaint = lookupSeriesOutlinePaint(series);↵

19

                        Stroke stroke = lookupSeriesStroke(series);↵

19

                    Stroke outlineStroke = lookupSeriesOutlineStroke(series);↵

20

                      ↵

21

      // TODO:  the following hard-coded line needs generalising↵

22

                        Line2D line = new Line2D.Double(-7.0, 0.0, 7.0, 0.0);↵

20

                    result = new LegendItem(label, description, toolTipText, ↵

23

                        result = new LegendItem(label, description, ↵

21

                            urlText, shape, paint, outlineStroke, outlinePaint);↵

24

                                toolTipText, urlText, line, stroke, paint);↵

22

                    result.setDataset(dataset);↵

25

                        result.setDataset(dataset);↵

23

                    result.setDatasetIndex(datasetIndex);↵

26

                        result.setDatasetIndex(datasetIndex);↵

24

                    result.setSeriesKey(dataset.getSeriesKey(series));↵

27

                        result.setSeriesKey(dataset.getSeriesKey(series));↵

25

                    result.setSeriesIndex(series);↵

28

                        result.setSeriesIndex(series);↵

29

                    }↵

26

                }

30

                }

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 16
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 8.1
   Clone type | Type 3

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

   7

       if (getItemVisible(series, 0))

   6

       if (getItemVisible(series, 0))

   8

       String label = getLegendItemLabelGenerator().generateLabel(dataset, series);

   7

       String label = getLegendItemLabelGenerator().generateLabel(dataset, series);

   9

       String description = label;

   8

       String description = label;

   10

       String toolTipText = null;

   9

       String toolTipText = null;

   11

       if (getLegendItemToolTipGenerator() != null)

   10

       if (getLegendItemToolTipGenerator() != null)

   12

       toolTipText = getLegendItemToolTipGenerator().generateLabel(dataset, series);

   11

       toolTipText = getLegendItemToolTipGenerator().generateLabel(dataset, series);

   13

       String urlText = null;

   12

       String urlText = null;

   14

       if (getLegendItemURLGenerator() != null)

   13

       if (getLegendItemURLGenerator() != null)

   15

       urlText = getLegendItemURLGenerator().generateLabel(dataset, series);

   14

       urlText = getLegendItemURLGenerator().generateLabel(dataset, series);

   16

       Shape shape = new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0);

   17

       Paint paint = lookupSeriesPaint(series);

   15

       Paint paint = lookupSeriesPaint(series);

   18

       Paint outlinePaint = lookupSeriesOutlinePaint(series);

   19

       Stroke outlineStroke = lookupSeriesOutlineStroke(series);

   19 | Stroke outlineStroke = lookupSeriesOutlineStroke(series);
   16 | Stroke stroke = lookupSeriesStroke(series);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   outlineStroke | stroke | VARIABLE_NAME_MISMATCH
   lookupSeriesOutlineStroke | lookupSeriesStroke | METHOD_INVOCATION_NAME_MISMATCH

   16

       Stroke stroke = lookupSeriesStroke(series);

   17

       Line2D line = new Line2D.Double(-7.0, 0.0, 7.0, 0.0);

   20

       result = new LegendItem(label, description, toolTipText, urlText, shape, paint, outlineStroke, outlinePaint);

   20 | result = new LegendItem(label, description, toolTipText, urlText, shape, paint, outlineStroke, outlinePaint);
   18 | result = new LegendItem(label, description, toolTipText, urlText, line, stroke, paint);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   new LegendItem(label,description,toolTipText,urlText,shape,paint,outlineStroke,outlinePaint) | new LegendItem(label,description,toolTipText,urlText,line,stroke,paint) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression new LegendItem(label,description,toolTipText,urlText,shape,paint,outlineStroke,outlinePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression new LegendItem(label,description,toolTipText,urlText,line,stroke,paint) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   18

       result = new LegendItem(label, description, toolTipText, urlText, line, stroke, paint);

   21

       result.setDataset(dataset);

   19

       result.setDataset(dataset);

   22

       result.setDatasetIndex(datasetIndex);

   20

       result.setDatasetIndex(datasetIndex);

   23

       result.setSeriesKey(dataset.getSeriesKey(series));

   21

       result.setSeriesKey(dataset.getSeriesKey(series));

   24

       result.setSeriesIndex(series);

   22

       result.setSeriesIndex(series);

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Expression new LegendItem(label,description,toolTipText,urlText,shape,paint,outlineStroke,outlinePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression new LegendItem(label,description,toolTipText,urlText,line,stroke,paint) cannot be parameterized, because it has dependencies to/from statements that will be extracted