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;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are in different classes having the same super class
Number of node comparisons373
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements22
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)72.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                              
    1
    CategoryPlot cp = getPlot();
    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
    Expression1Expression2Difference
    shapeVisibletrueTYPE_COMPATIBLE_REPLACEMENT
    lineVisiblefalseTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression shapeVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression lineVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    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 (6)
    Row Violation
    1Unmatched statement boolean lineVisible=getItemLineVisible(series,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement boolean shapeVisible=getItemShapeVisible(series,0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Expression shapeVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression lineVisible cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched return null;
    6Not all possible execution flows end in a return statement