146-1-2

if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) { CategoryDataset dataset = cp.getDataset(datasetIndex); 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 = lookupSeriesShape(series); Paint paint = lookupSeriesPaint(series); Paint fillPaint = (this.useFillPaint ? getItemFillPaint(series, 0) : paint); boolean shapeOutlineVisible = this.drawOutlines; Paint outlinePaint = (this.useOutlinePaint ? getItemOutlinePaint(series, 0) : paint); Stroke outlineStroke = lookupSeriesOutlineStroke(series); boolean lineVisible = getItemLineVisible(series, 0); boolean shapeVisible = getItemShapeVisible(series, 0); LegendItem result = new LegendItem(label, description, toolTipText, urlText, shapeVisible, shape, getItemShapeFilled(series, 0), fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible, new Line2D.Double(-7.0, 0.0, 7.0, 0.0), getItemStroke(series, 0), getItemPaint(series, 0)); result.setDataset(dataset); result.setDatasetIndex(datasetIndex); result.setSeriesKey(dataset.getRowKey(series)); result.setSeriesIndex(series); return result; }
CategoryPlot cp = getPlot(); if (cp == null) { return null; } if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) { CategoryDataset dataset = cp.getDataset(datasetIndex); 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 = lookupSeriesShape(series); Paint paint = lookupSeriesPaint(series); Paint fillPaint = (this.useFillPaint ? getItemFillPaint(series, 0) : paint); boolean shapeOutlineVisible = this.drawOutlines; Paint outlinePaint = (this.useOutlinePaint ? getItemOutlinePaint(series, 0) : paint); Stroke outlineStroke = lookupSeriesOutlineStroke(series); LegendItem result = new LegendItem(label, description, toolTipText, urlText, true, shape, getItemShapeFilled(series, 0), fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0), getItemStroke(series, 0), getItemPaint(series, 0)); result.setDataset(dataset); result.setDatasetIndex(datasetIndex); result.setSeriesKey(dataset.getRowKey(series)); result.setSeriesIndex(series); return result; } return null;

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/ScatterRenderer.java
Method name: `LegendItem getLegendItem(int, int)` |  | Method name: `LegendItem getLegendItem(int, int)`
Number of AST nodes: 24 |  | Number of AST nodes: 26

1

    CategoryPlot cp = getPlot();↵

2

            if (cp == null) {↵

3

                return null;↵

4

            }↵

1

    if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {↵

5

            if (isSeriesVisible(series) && isSeriesVisibleInLegend(series)) {↵

2

                CategoryDataset dataset = cp.getDataset(datasetIndex);↵

6

                CategoryDataset dataset = cp.getDataset(datasetIndex);↵

3

                String label = getLegendItemLabelGenerator().generateLabel(↵

7

                String label = getLegendItemLabelGenerator().generateLabel(↵

4

                        dataset, series);↵

8

                        dataset, series);↵

5

                String description = label;↵

9

                String description = label;↵

6

                String toolTipText = null;↵

10

                String toolTipText = null;↵

7

                if (getLegendItemToolTipGenerator() != null) {↵

11

                if (getLegendItemToolTipGenerator() != null) {↵

8

                    toolTipText = getLegendItemToolTipGenerator().generateLabel(↵

12

                    toolTipText = getLegendItemToolTipGenerator().generateLabel(↵

9

                            dataset, series);↵

13

                            dataset, series);↵

10

                }↵

14

                }↵

11

                String urlText = null;↵

15

                String urlText = null;↵

12

                if (getLegendItemURLGenerator() != null) {↵

16

                if (getLegendItemURLGenerator() != null) {↵

13

                    urlText = getLegendItemURLGenerator().generateLabel(↵

17

                    urlText = getLegendItemURLGenerator().generateLabel(↵

14

                            dataset, series);↵

18

                            dataset, series);↵

15

                }↵

19

                }↵

16

                Shape shape = lookupSeriesShape(series);↵

20

                Shape shape = lookupSeriesShape(series);↵

17

                Paint paint = lookupSeriesPaint(series);↵

21

                Paint paint = lookupSeriesPaint(series);↵

18

                Paint fillPaint = (this.useFillPaint↵

22

                Paint fillPaint = (this.useFillPaint↵

19

                        ? getItemFillPaint(series, 0) : paint);↵

23

                        ? getItemFillPaint(series, 0) : paint);↵

20

                boolean shapeOutlineVisible = this.drawOutlines;↵

24

                boolean shapeOutlineVisible = this.drawOutlines;↵

21

                Paint outlinePaint = (this.useOutlinePaint↵

25

                Paint outlinePaint = (this.useOutlinePaint↵

22

                        ? getItemOutlinePaint(series, 0) : paint);↵

26

                        ? getItemOutlinePaint(series, 0) : paint);↵

23

                Stroke outlineStroke = lookupSeriesOutlineStroke(series);↵

27

                Stroke outlineStroke = lookupSeriesOutlineStroke(series);↵

24

                boolean lineVisible = getItemLineVisible(series, 0);↵

25

                boolean shapeVisible = getItemShapeVisible(series, 0);↵

26

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

28

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

27

                        urlText, shapeVisible, shape, getItemShapeFilled(series, 0),↵

29

                        urlText, true, shape, getItemShapeFilled(series, 0),↵

28

                        fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke,↵

30

                        fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke,↵

29

                        lineVisible, new Line2D.Double(-7.0, 0.0, 7.0, 0.0),↵

31

                        false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0),↵

30

                        getItemStroke(series, 0), getItemPaint(series, 0));↵

32

                        getItemStroke(series, 0), getItemPaint(series, 0));↵

31

                result.setDataset(dataset);↵

33

                result.setDataset(dataset);↵

32

                result.setDatasetIndex(datasetIndex);↵

34

                result.setDatasetIndex(datasetIndex);↵

33

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

35

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

34

                result.setSeriesIndex(series);↵

36

                result.setSeriesIndex(series);↵

35

                return result;↵

37

                return result;↵

36

            }

38

            }↵

39

            return null;

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 | 373

1. {Non-refactorable}

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

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

   1

       CategoryPlot cp = getPlot();

   2

       if (cp == null)

   3 | return null;

   Preondition Violations
   Unmatched return null;

   3

       return null;

   4

       if (isSeriesVisible(series) && isSeriesVisibleInLegend(series))

   4

       if (isSeriesVisible(series) && isSeriesVisibleInLegend(series))

   5

       CategoryDataset dataset = cp.getDataset(datasetIndex);

   5

       CategoryDataset dataset = cp.getDataset(datasetIndex);

   6

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

   6

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

   7

       String description = label;

   7

       String description = label;

   8

       String toolTipText = null;

   8

       String toolTipText = null;

   9

       if (getLegendItemToolTipGenerator() != null)

   9

       if (getLegendItemToolTipGenerator() != null)

   10

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

   10

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

   11

       String urlText = null;

   11

       String urlText = null;

   12

       if (getLegendItemURLGenerator() != null)

   12

       if (getLegendItemURLGenerator() != null)

   13

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

   13

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

   14

       Shape shape = lookupSeriesShape(series);

   14

       Shape shape = lookupSeriesShape(series);

   15

       Paint paint = lookupSeriesPaint(series);

   15

       Paint paint = lookupSeriesPaint(series);

   16

       Paint fillPaint = (this.useFillPaint ? getItemFillPaint(series, 0) : paint);

   16

       Paint fillPaint = (this.useFillPaint ? getItemFillPaint(series, 0) : paint);

   17

       boolean shapeOutlineVisible = this.drawOutlines;

   17

       boolean shapeOutlineVisible = this.drawOutlines;

   18

       Paint outlinePaint = (this.useOutlinePaint ? getItemOutlinePaint(series, 0) : paint);

   18

       Paint outlinePaint = (this.useOutlinePaint ? getItemOutlinePaint(series, 0) : paint);

   19

       Stroke outlineStroke = lookupSeriesOutlineStroke(series);

   19

       Stroke outlineStroke = lookupSeriesOutlineStroke(series);

   20

       boolean lineVisible = getItemLineVisible(series, 0);

   20 | boolean lineVisible = getItemLineVisible(series, 0);

   Preondition Violations
   Unmatched statement boolean lineVisible=getItemLineVisible(series,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   21

       boolean shapeVisible = getItemShapeVisible(series, 0);

   21 | boolean shapeVisible = getItemShapeVisible(series, 0);

   Preondition Violations
   Unmatched statement boolean shapeVisible=getItemShapeVisible(series,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted

   22

       LegendItem result = new LegendItem(label, description, toolTipText, urlText, shapeVisible, shape, getItemShapeFilled(series, 0), fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible, new Line2D.Double(-7.0, 0.0, 7.0, 0.0), getItemStroke(series, 0), getItemPaint(series, 0));

   22 | LegendItem result = new LegendItem(label, description, toolTipText, urlText, shapeVisible, shape, getItemShapeFilled(series, 0), fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible, new Line2D.Double(-7.0, 0.0, 7.0, 0.0), getItemStroke(series, 0), getItemPaint(series, 0));
   20 | LegendItem result = new LegendItem(label, description, toolTipText, urlText, true, shape, getItemShapeFilled(series, 0), fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0), getItemStroke(series, 0), getItemPaint(series, 0));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   shapeVisible | true | TYPE_COMPATIBLE_REPLACEMENT
   lineVisible | false | TYPE_COMPATIBLE_REPLACEMENT

   20

       LegendItem result = new LegendItem(label, description, toolTipText, urlText, true, shape, getItemShapeFilled(series, 0), fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, false, new Line2D.Double(-7.0, 0.0, 7.0, 0.0), getItemStroke(series, 0), getItemPaint(series, 0));

   23

       result.setDataset(dataset);

   21

       result.setDataset(dataset);

   24

       result.setDatasetIndex(datasetIndex);

   22

       result.setDatasetIndex(datasetIndex);

   25

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

   23

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

   26

       result.setSeriesIndex(series);

   24

       result.setSeriesIndex(series);

   27

       return result;

   25

       return result;

   26 | return null;

   Preondition Violations
   Unmatched return null;

   26

       return null;

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Unmatched return null;
   2 | Unmatched statement boolean lineVisible=getItemLineVisible(series,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   3 | Unmatched statement boolean shapeVisible=getItemShapeVisible(series,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
   4 | Unmatched return null;