XYSeries series = new XYSeries("Series 1"); series.add(1.0, 1.0); series.add(2.0, 2.0); series.add(3.0, 3.0); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createScatterPlot( "Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false ); XYPlot plot = (XYPlot) chart.getPlot(); LogAxis axis = new LogAxis("Log(Y)"); plot.setRangeAxis(axis); assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON); assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
XYSeries series = new XYSeries("Series 1"); series.add(1.0, 1.0); series.add(2.0, 2.0); series.add(3.0, 3.0); XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(series); JFreeChart chart = ChartFactory.createScatterPlot( "Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false ); XYPlot plot = (XYPlot) chart.getPlot(); NumberAxis axis = (NumberAxis) plot.getDomainAxis(); axis.setAutoRangeIncludesZero(false); assertEquals(0.9, axis.getLowerBound(), EPSILON); assertEquals(3.1, axis.getUpperBound(), EPSILON);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/LogAxisTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/axis/junit/NumberAxisTests.java
Method name: void testXYAutoRange2() Method name: void testXYAutoRange1()
Number of AST nodes: 12 Number of AST nodes: 12
1
XYSeries series = new XYSeries("Series 1");
1
XYSeries series = new XYSeries("Series 1");
2
        series.add(1.0, 1.0);
2
        series.add(1.0, 1.0);
3
        series.add(2.0, 2.0);
3
        series.add(2.0, 2.0);
4
        series.add(3.0, 3.0);
4
        series.add(3.0, 3.0);
5
        XYSeriesCollection dataset = new XYSeriesCollection();
5
        XYSeriesCollection dataset = new XYSeriesCollection();
6
        dataset.addSeries(series);
6
        dataset.addSeries(series);
7
        JFreeChart chart = ChartFactory.createScatterPlot(
7
        JFreeChart chart = ChartFactory.createScatterPlot(
8
            "Test",
8
            "Test", 
9
            "X",
9
            "X",
10
            "Y",
10
            "Y",
11
            dataset,
11
            dataset,
12
            PlotOrientation.VERTICAL,
12
            PlotOrientation.VERTICAL,
13
            false,
13
            false, 
14
            false,
14
            false,
15
            false
15
            false
16
        );
16
        );
17
        XYPlot plot = (XYPlot) chart.getPlot();
17
        XYPlot plot = (XYPlot) chart.getPlot();
18
        LogAxis axis = new LogAxis("Log(Y)");
18
        NumberAxis axis = 
19
        plot.setRangeAxis(axis
19
(NumberAxis) plot.getDomainAxis();
20
);
20
        axis.setAutoRangeIncludesZero(false);
21
        assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
21
        assertEquals(0.9, axis.getLowerBound(), EPSILON);    
22
        assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
22
        assertEquals(3.1, axis.getUpperBound(), EPSILON);
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 comparisons72
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    XYSeries series = new XYSeries("Series 1");
    1
    XYSeries series = new XYSeries("Series 1");
    2
    series.add(1.0, 1.0);
    2
    series.add(1.0, 1.0);
    3
    series.add(2.0, 2.0);
    3
    series.add(2.0, 2.0);
    4
    series.add(3.0, 3.0);
    4
    series.add(3.0, 3.0);
    5
    XYSeriesCollection dataset = new XYSeriesCollection();
    5
    XYSeriesCollection dataset = new XYSeriesCollection();
    6
    dataset.addSeries(series);
    6
    dataset.addSeries(series);
    7
    JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    7
    JFreeChart chart = ChartFactory.createScatterPlot("Test", "X", "Y", dataset, PlotOrientation.VERTICAL, false, false, false);
    8
    XYPlot plot = (XYPlot)chart.getPlot();
    8
    XYPlot plot = (XYPlot)chart.getPlot();
    9
    LogAxis axis = new LogAxis("Log(Y)");
    9
    LogAxis axis = new LogAxis("Log(Y)");
    9
    NumberAxis axis = (NumberAxis)plot.getDomainAxis();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.LogAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.LogAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.LogAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    new LogAxis("Log(Y)")(NumberAxis)plot.getDomainAxis()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (NumberAxis)plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    NumberAxis axis = (NumberAxis)plot.getDomainAxis();
                                                                                      
    10
    axis.setAutoRangeIncludesZero(false);
    Preondition Violations
    Unmatched statement axis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    axis.setAutoRangeIncludesZero(false);
    10
    plot.setRangeAxis(axis);
    10
    plot.setRangeAxis(axis);
    Preondition Violations
    Unmatched statement plot.setRangeAxis(axis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                            
    11
    assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
    11
    assertEquals(0.9465508226401592, axis.getLowerBound(), EPSILON);
    11
    assertEquals(0.9, axis.getLowerBound(), EPSILON);
    Differences
    Expression1Expression2Difference
    0.94655082264015920.9LITERAL_VALUE_MISMATCH
    org.jfree.chart.axis.LogAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    11
    assertEquals(0.9, axis.getLowerBound(), EPSILON);
    12
    assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
    12
    assertEquals(3.1694019256486126, axis.getUpperBound(), EPSILON);
    12
    assertEquals(3.1, axis.getUpperBound(), EPSILON);
    Differences
    Expression1Expression2Difference
    3.16940192564861263.1LITERAL_VALUE_MISMATCH
    org.jfree.chart.axis.LogAxisorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    12
    assertEquals(3.1, axis.getUpperBound(), EPSILON);
    Precondition Violations (4)
    Row Violation
    1Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (NumberAxis)plot.getDomainAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement axis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement plot.setRangeAxis(axis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted