DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(100.0, "Row 1", "Column 1"); dataset.setValue(200.0, "Row 1", "Column 2"); JFreeChart chart = ChartFactory.createBarChart( "Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); LogAxis axis = new LogAxis("Log(Y)"); plot.setRangeAxis(axis); assertEquals(0.0, axis.getLowerBound(), EPSILON); assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.setValue(100.0, "Row 1", "Column 1"); dataset.setValue(200.0, "Row 1", "Column 2"); JFreeChart chart = ChartFactory.createLineChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis axis = (NumberAxis) plot.getRangeAxis(); axis.setAutoRangeIncludesZero(false); assertEquals(axis.getLowerBound(), 95.0, EPSILON); assertEquals(axis.getUpperBound(), 205.0, 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 testAutoRange1() Method name: void testAutoRange2()
Number of AST nodes: 9 Number of AST nodes: 9
1
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
1
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
2
        dataset.setValue(100.0, "Row 1", "Column 1");
2
        dataset.setValue(100.0, "Row 1", "Column 1");
3
        dataset.setValue(200.0, "Row 1", "Column 2");
3
        dataset.setValue(200.0, "Row 1", "Column 2");
4
        JFreeChart chart = ChartFactory.createBarChart(
4
        JFreeChart chart = ChartFactory.createLineChart(
5
            "Test",
6
            "Categories",
5
"Test", "Categories",
7
            "Value",
6
                "Value",
8
            dataset,
9
            PlotOrientation.VERTICAL,
10
            false,
11
            false,
7
 dataset, PlotOrientation.VERTICAL, false, false,
12
            false
8
                false
13
        );
9
);
14
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
10
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
15
        LogAxis axis = new LogAxis("Log(Y)");
11
        NumberAxis axis = 
16
        plot.setRangeAxis(axis
12
(NumberAxis) plot.getRangeAxis();
17
);
13
        axis.setAutoRangeIncludesZero(false);
18
        assertEquals(0.0, axis.getLowerBound(), EPSILON);
14
        assertEquals(axis.getLowerBound(), 95.0, EPSILON);    
19
        assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
15
        assertEquals(axis.getUpperBound(), 205.0, EPSILON);
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons46
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    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
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    1
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    2
    dataset.setValue(100.0, "Row 1", "Column 1");
    2
    dataset.setValue(100.0, "Row 1", "Column 1");
    3
    dataset.setValue(200.0, "Row 1", "Column 2");
    3
    dataset.setValue(200.0, "Row 1", "Column 2");
    4
    JFreeChart chart = ChartFactory.createBarChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false);
    4
    JFreeChart chart = ChartFactory.createBarChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false);
    4
    JFreeChart chart = ChartFactory.createLineChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false);
    Differences
    Expression1Expression2Difference
    createBarChartcreateLineChartMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression ChartFactory.createBarChart("Test","Categories","Value",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ChartFactory.createLineChart("Test","Categories","Value",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    JFreeChart chart = ChartFactory.createLineChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false);
    5
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    5
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    6
    LogAxis axis = new LogAxis("Log(Y)");
    6
    LogAxis axis = new LogAxis("Log(Y)");
    6
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
    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.getRangeAxis()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.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
                                                                                    
    7
    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
    7
    axis.setAutoRangeIncludesZero(false);
    7
    plot.setRangeAxis(axis);
    7
    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
                                                          
    8
    assertEquals(0.0, axis.getLowerBound(), EPSILON);
    8
    assertEquals(0.0, axis.getLowerBound(), EPSILON);
    8
    assertEquals(axis.getLowerBound(), 95.0, EPSILON);
    Differences
    Expression1Expression2Difference
    0.0axis.getLowerBound()TYPE_COMPATIBLE_REPLACEMENT
    axis.getLowerBound()95.0TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    assertEquals(axis.getLowerBound(), 95.0, EPSILON);
    9
    assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
    9
    assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
    9
    assertEquals(axis.getUpperBound(), 205.0, EPSILON);
    Differences
    Expression1Expression2Difference
    2.6066426411261268E7axis.getUpperBound()TYPE_COMPATIBLE_REPLACEMENT
    axis.getUpperBound()205.0TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    assertEquals(axis.getUpperBound(), 205.0, EPSILON);
    Precondition Violations (10)
    Row Violation
    1Expression ChartFactory.createBarChart("Test","Categories","Value",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression ChartFactory.createLineChart("Test","Categories","Value",dataset,PlotOrientation.VERTICAL,false,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression (NumberAxis)plot.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Unmatched statement axis.setAutoRangeIncludesZero(false); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement plot.setRangeAxis(axis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted