TableXYDataset dataset = RendererXYPackageTests.createTestTableXYDataset(); JFreeChart chart = ChartFactory.createStackedXYAreaChart( "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setRenderer(new StackedXYBarRenderer()); NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis(); domainAxis.setAutoRangeIncludesZero(false); Range bounds = domainAxis.getRange(); assertFalse(bounds.contains(0.3)); assertTrue(bounds.contains(0.5)); assertTrue(bounds.contains(2.5)); assertFalse(bounds.contains(2.8));
TableXYDataset dataset = RendererXYPackageTests.createTestTableXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart( "Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setAutoRangeIncludesZero(false); Range bounds = rangeAxis.getRange(); assertFalse(bounds.contains(1.0)); assertTrue(bounds.contains(2.0)); assertTrue(bounds.contains(5.0)); assertFalse(bounds.contains(6.0));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/StackedXYBarRendererTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/XYLineAndShapeRendererTests.java
Method name: void testFindDomainBounds() Method name: void testFindRangeBounds()
Number of AST nodes: 11 Number of AST nodes: 10
1
TableXYDataset dataset
1
TableXYDataset dataset
2
                = RendererXYPackageTests.createTestTableXYDataset();
2
                = RendererXYPackageTests.createTestTableXYDataset();
3
        JFreeChart chart = ChartFactory.createStackedXYAreaChart(
3
        JFreeChart chart = ChartFactory.createXYLineChart(
4
                "Test Chart", "X", "Y", dataset,
4
                "Test Chart", "X", "Y", dataset,
5
                PlotOrientation.VERTICAL,
5
 PlotOrientation.VERTICAL,
6
 false, false, false);
6
                false, false, false);
7
        XYPlot plot = (XYPlot) chart.getPlot();
7
        XYPlot plot = (XYPlot) chart.getPlot();
8
        plot.setRenderer(new StackedXYBarRenderer());
9
        NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
8
        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
10
        domainAxis.setAutoRangeIncludesZero(false);
9
        rangeAxis.setAutoRangeIncludesZero(false);
11
        Range bounds = domainAxis.getRange();
10
        Range bounds = rangeAxis.getRange();
12
        assertFalse(bounds.contains(0.3));
11
        assertFalse(bounds.contains(1.0));
13
        assertTrue(bounds.contains(0.5));
12
        assertTrue(bounds.contains(2.0));
14
        assertTrue(bounds.contains(2.5));
13
        assertTrue(bounds.contains(5.0));
15
        assertFalse(bounds.contains(2.8));
14
        assertFalse(bounds.contains(6.0));
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons80
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    TableXYDataset dataset = RendererXYPackageTests.createTestTableXYDataset();
    1
    TableXYDataset dataset = RendererXYPackageTests.createTestTableXYDataset();
    2
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    2
    JFreeChart chart = ChartFactory.createStackedXYAreaChart("Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    2
    JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    Differences
    Expression1Expression2Difference
    createStackedXYAreaChartcreateXYLineChartMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression ChartFactory.createStackedXYAreaChart("Test Chart","X","Y",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ChartFactory.createXYLineChart("Test Chart","X","Y",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    JFreeChart chart = ChartFactory.createXYLineChart("Test Chart", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    3
    XYPlot plot = (XYPlot)chart.getPlot();
    3
    XYPlot plot = (XYPlot)chart.getPlot();
    4
    plot.setRenderer(new StackedXYBarRenderer());
    4
    plot.setRenderer(new StackedXYBarRenderer());
    Preondition Violations
    Unmatched statement plot.setRenderer(new StackedXYBarRenderer()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    5
    NumberAxis domainAxis = (NumberAxis)plot.getDomainAxis();
    5
    NumberAxis domainAxis = (NumberAxis)plot.getDomainAxis();
    4
    NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
    Differences
    Expression1Expression2Difference
    domainAxisrangeAxisVARIABLE_NAME_MISMATCH
    getDomainAxisgetRangeAxisMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    NumberAxis rangeAxis = (NumberAxis)plot.getRangeAxis();
    6
    domainAxis.setAutoRangeIncludesZero(false);
    6
    domainAxis.setAutoRangeIncludesZero(false);
    5
    rangeAxis.setAutoRangeIncludesZero(false);
    Differences
    Expression1Expression2Difference
    domainAxisrangeAxisVARIABLE_NAME_MISMATCH
    5
    rangeAxis.setAutoRangeIncludesZero(false);
    7
    Range bounds = domainAxis.getRange();
    7
    Range bounds = domainAxis.getRange();
    6
    Range bounds = rangeAxis.getRange();
    Differences
    Expression1Expression2Difference
    domainAxisrangeAxisVARIABLE_NAME_MISMATCH
    6
    Range bounds = rangeAxis.getRange();
    8
    assertFalse(bounds.contains(0.3));
    8
    assertFalse(bounds.contains(0.3));
    7
    assertFalse(bounds.contains(1.0));
    Differences
    Expression1Expression2Difference
    0.31.0LITERAL_VALUE_MISMATCH
    7
    assertFalse(bounds.contains(1.0));
    9
    assertTrue(bounds.contains(0.5));
    9
    assertTrue(bounds.contains(0.5));
    9
    assertTrue(bounds.contains(5.0));
    Differences
    Expression1Expression2Difference
    0.55.0LITERAL_VALUE_MISMATCH
    9
    assertTrue(bounds.contains(5.0));
    10
    assertTrue(bounds.contains(2.5));
    10
    assertTrue(bounds.contains(2.5));
    8
    assertTrue(bounds.contains(2.0));
    Differences
    Expression1Expression2Difference
    2.52.0LITERAL_VALUE_MISMATCH
    8
    assertTrue(bounds.contains(2.0));
    11
    assertFalse(bounds.contains(2.8));
    11
    assertFalse(bounds.contains(2.8));
    10
    assertFalse(bounds.contains(6.0));
    Differences
    Expression1Expression2Difference
    2.86.0LITERAL_VALUE_MISMATCH
    10
    assertFalse(bounds.contains(6.0));
    Precondition Violations (5)
    Row Violation
    1Expression ChartFactory.createStackedXYAreaChart("Test Chart","X","Y",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ChartFactory.createXYLineChart("Test Chart","X","Y",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement plot.setRenderer(new StackedXYBarRenderer()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression plot.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted