if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } DateAxis xAxis = new DateAxis(xAxisLabel); NumberAxis yAxis = new NumberAxis(yAxisLabel); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart;
if (orientation == null) { throw new IllegalArgumentException("Null 'orientation' argument."); } NumberAxis xAxis = new NumberAxis(xAxisLabel); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(yAxisLabel); XYToolTipGenerator toolTipGenerator = null; if (tooltips) { toolTipGenerator = new StandardXYToolTipGenerator(); } XYURLGenerator urlGenerator = null; if (urls) { urlGenerator = new StandardXYURLGenerator(); } XYItemRenderer renderer = new XYStepAreaRenderer( XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, urlGenerator); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); plot.setRenderer(renderer); plot.setOrientation(orientation); plot.setDomainCrosshairVisible(false); plot.setRangeCrosshairVisible(false); JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); return chart;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartFactory.java File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartFactory.java
Method name: JFreeChart createXYStepChart(String, String, String, XYDataset, PlotOrientation, boolean, boolean, boolean) Method name: JFreeChart createXYStepAreaChart(String, String, String, XYDataset, PlotOrientation, boolean, boolean, boolean)
Number of AST nodes: 19 Number of AST nodes: 19
1
if (orientation == null) {
1
if (orientation == null) {
2
            throw new IllegalArgumentException("Null 'orientation' argument.");
2
            throw new IllegalArgumentException("Null 'orientation' argument.");
3
        }
3
        }
4
        DateAxis xAxis = new DateAxis(xAxisLabel);
4
        NumberAxis xAxis = new NumberAxis(xAxisLabel);
5
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
5
        
6
        yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()
6
xAxis.setAutoRangeIncludesZero(false);
7
);
7
        NumberAxis yAxis = new NumberAxis(yAxisLabel);
8
        XYToolTipGenerator toolTipGenerator = null;
8
        XYToolTipGenerator toolTipGenerator = null;
9
        if (tooltips) {
9
        if (tooltips) {
10
            toolTipGenerator = new StandardXYToolTipGenerator();
10
            toolTipGenerator = new StandardXYToolTipGenerator();
11
        }
11
        }
12
        XYURLGenerator urlGenerator = null;
12
        XYURLGenerator urlGenerator = null;
13
        if (urls) {
13
        if (urls) {
14
            urlGenerator = new StandardXYURLGenerator();
14
            urlGenerator = new StandardXYURLGenerator();
15
        }
15
        }
16
        XYItemRenderer renderer 
16
        XYItemRenderer renderer = new XYStepAreaRenderer(
17
            = new XYStepRenderer(toolTipGenerator,
17
                XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, 
18
 urlGenerator);
18
                urlGenerator);
19
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
19
        XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
20
        plot.setRenderer(renderer);
20
        plot.setRenderer(renderer);
21
        plot.setOrientation(orientation);
21
        plot.setOrientation(orientation);
22
        plot.setDomainCrosshairVisible(false);
22
        plot.setDomainCrosshairVisible(false);
23
        plot.setRangeCrosshairVisible(false);
23
        plot.setRangeCrosshairVisible(false);
24
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
24
        JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT,
25
                plot, legend);
25
                plot, legend);
26
        return chart;
26
        return chart;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons79
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements18
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)160.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (orientation == null)
    1
    if (orientation == null)
    2
    throw new IllegalArgumentException("Null 'orientation' argument.");
    2
    throw new IllegalArgumentException("Null 'orientation' argument.");
    3
    DateAxis xAxis = new DateAxis(xAxisLabel);
    3
    DateAxis xAxis = new DateAxis(xAxisLabel);
    3
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.DateAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.DateAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new DateAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new NumberAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    NumberAxis xAxis = new NumberAxis(xAxisLabel);
                                                                                      
    4
    xAxis.setAutoRangeIncludesZero(false);
    Preondition Violations
    Unmatched statement xAxis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    xAxis.setAutoRangeIncludesZero(false);
    4
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    5
    NumberAxis yAxis = new NumberAxis(yAxisLabel);
    5
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    5
    yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    Preondition Violations
    Unmatched statement yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                          
    6
    XYToolTipGenerator toolTipGenerator = null;
    6
    XYToolTipGenerator toolTipGenerator = null;
    7
    if (tooltips)
    7
    if (tooltips)
    8
    toolTipGenerator = new StandardXYToolTipGenerator();
    8
    toolTipGenerator = new StandardXYToolTipGenerator();
    9
    XYURLGenerator urlGenerator = null;
    9
    XYURLGenerator urlGenerator = null;
    10
    if (urls)
    10
    if (urls)
    11
    urlGenerator = new StandardXYURLGenerator();
    11
    urlGenerator = new StandardXYURLGenerator();
    12
    XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator);
    12
    XYItemRenderer renderer = new XYStepRenderer(toolTipGenerator, urlGenerator);
    12
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, urlGenerator);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.XYStepRendererorg.jfree.chart.renderer.xy.XYStepAreaRendererSUBCLASS_TYPE_MISMATCH
    new XYStepRenderer(toolTipGenerator,urlGenerator)new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new XYStepRenderer(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYStepRenderer(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    XYItemRenderer renderer = new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES, toolTipGenerator, urlGenerator);
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.DateAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    13
    XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null);
    14
    plot.setRenderer(renderer);
    14
    plot.setRenderer(renderer);
    15
    plot.setOrientation(orientation);
    15
    plot.setOrientation(orientation);
    16
    plot.setDomainCrosshairVisible(false);
    16
    plot.setDomainCrosshairVisible(false);
    17
    plot.setRangeCrosshairVisible(false);
    17
    plot.setRangeCrosshairVisible(false);
    18
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    18
    JFreeChart chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, legend);
    19
    return chart;
    19
    return chart;
    Precondition Violations (8)
    Row Violation
    1Expression new DateAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new NumberAxis(xAxisLabel) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement xAxis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Expression new XYStepRenderer(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression new XYStepRenderer(toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression new XYStepAreaRenderer(XYStepAreaRenderer.AREA_AND_SHAPES,toolTipGenerator,urlGenerator) cannot be parameterized, because it has dependencies to/from statements that will be extracted