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.createBarChart( "Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false ); CategoryPlot plot = (CategoryPlot) chart.getPlot(); NumberAxis axis = (NumberAxis) plot.getRangeAxis(); assertEquals(axis.getLowerBound(), 0.0, EPSILON); assertEquals(axis.getUpperBound(), 210.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 testAutoRange1()
Number of AST nodes: 9 Number of AST nodes: 8
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.createBarChart(
5
            "Test",
5
            "Test", 
6
            "Categories",
6
            "Categories",
7
            "Value",
7
            "Value",
8
            dataset,
8
            dataset,
9
            PlotOrientation.VERTICAL,
9
            PlotOrientation.VERTICAL,
10
            false,
10
            false, 
11
            false,
11
            false,
12
            false
12
            false
13
        );
13
        );
14
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
14
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
15
        LogAxis axis = new LogAxis("Log(Y)");
15
        NumberAxis axis = 
16
        plot.setRangeAxis(axis);
16
(NumberAxis) plot.getRangeAxis();
17
        assertEquals(0.0, axis.getLowerBound(), EPSILON);
17
        assertEquals(axis.getLowerBound(), 0.0, EPSILON);    
18
        assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
18
        assertEquals(axis.getUpperBound(), 210.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 comparisons48
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    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);
    5
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
    5
    CategoryPlot plot = (CategoryPlot)chart.getPlot();
                                                                                                          
    6
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
    Preondition Violations
    Unmatched statement NumberAxis axis=(NumberAxis)plot.getRangeAxis(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
    6
    LogAxis axis = new LogAxis("Log(Y)");
    6
    LogAxis axis = new LogAxis("Log(Y)");
    Preondition Violations
    Unmatched statement LogAxis axis=new LogAxis("Log(Y)"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                
    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.getUpperBound(), 210.0, EPSILON);
    Differences
    Expression1Expression2Difference
    0.0axis.getUpperBound()TYPE_COMPATIBLE_REPLACEMENT
    axis.getLowerBound()210.0TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression axis.getUpperBound() 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.getUpperBound(), 210.0, EPSILON);
    9
    assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
    9
    assertEquals(2.6066426411261268E7, axis.getUpperBound(), EPSILON);
    7
    assertEquals(axis.getLowerBound(), 0.0, EPSILON);
    Differences
    Expression1Expression2Difference
    2.6066426411261268E7axis.getLowerBound()TYPE_COMPATIBLE_REPLACEMENT
    axis.getUpperBound()0.0TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression axis.getLowerBound() 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
    7
    assertEquals(axis.getLowerBound(), 0.0, EPSILON);
    Precondition Violations (7)
    Row Violation
    1Unmatched statement NumberAxis axis=(NumberAxis)plot.getRangeAxis(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement LogAxis axis=new LogAxis("Log(Y)"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement plot.setRangeAxis(axis); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted