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(); LogAxis axis = new LogAxis("Log(Y)"); plot.setRangeAxis(axis); assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON); assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON); // now replacing the dataset should update the axis range... DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(900.0, "Row 1", "Column 1"); dataset2.setValue(1000.0, "Row 1", "Column 2"); plot.setDataset(dataset2); assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON); assertEquals(1005.2819262292991, 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); // now replacing the dataset should update the axis range... DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); dataset2.setValue(900.0, "Row 1", "Column 1"); dataset2.setValue(1000.0, "Row 1", "Column 2"); plot.setDataset(dataset2); assertEquals(axis.getLowerBound(), 895.0, EPSILON); assertEquals(axis.getUpperBound(), 1005.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 testAutoRange3() Method name: void testAutoRange3()
Number of AST nodes: 15 Number of AST nodes: 15
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.createLineChart("Test", "Categories",
4
        JFreeChart chart = ChartFactory.createLineChart("Test", "Categories",
5
                "Value", dataset, PlotOrientation.VERTICAL, false, false,
5
                "Value", dataset, PlotOrientation.VERTICAL, false, false,
6
                false);
6
                false);
7
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
7
        CategoryPlot plot = (CategoryPlot) chart.getPlot();
8
        LogAxis axis = new LogAxis("Log(Y)");
8
        NumberAxis axis = 
9
        plot.setRangeAxis(axis
9
(NumberAxis) plot.getRangeAxis();
10
);
10
        axis.setAutoRangeIncludesZero(false);
11
        assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
11
        assertEquals(axis.getLowerBound(), 95.0, EPSILON);    
12
        assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON);
12
        assertEquals(axis.getUpperBound(), 205.0, EPSILON);
13
    
14
        
13
        // now replacing the dataset should update the axis range...
15
        // now replacing the dataset should update the axis range...
14
        DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
16
        DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
15
        dataset2.setValue(900.0, "Row 1", "Column 1");
17
        dataset2.setValue(900.0, "Row 1", "Column 1");
16
        dataset2.setValue(1000.0, "Row 1", "Column 2");
18
        dataset2.setValue(1000.0, "Row 1", "Column 2");
17
        plot.setDataset(dataset2);
19
        plot.setDataset(dataset2);
18
        assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
20
        assertEquals(axis.getLowerBound(), 895.0, EPSILON);    
19
        assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
21
        assertEquals(axis.getUpperBound(), 1005.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 comparisons88
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements15
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    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.createLineChart("Test", "Categories", "Value", dataset, PlotOrientation.VERTICAL, false, false, false);
    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)");
    10
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.axis.LogAxisorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    axisdataset2VARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.LogAxisorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.axis.LogAxisorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    new LogAxis("Log(Y)")new DefaultCategoryDataset()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DefaultCategoryDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DefaultCategoryDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    7
    plot.setRangeAxis(axis);
    7
    plot.setRangeAxis(axis);
    11
    dataset2.setValue(900.0, "Row 1", "Column 1");
    Differences
    Expression1Expression2Difference
    setRangeAxissetValueMETHOD_INVOCATION_NAME_MISMATCH
    plotdataset2VARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    plot.setRangeAxis(axis)dataset2.setValue(900.0,"Row 1","Column 1")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
    Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot cannot be unified with expression dataset2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setRangeAxis(org.jfree.chart.axis.ValueAxis) , public void setValue(double, Comparable#RAW, Comparable#RAW)
    Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
    Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    11
    dataset2.setValue(900.0, "Row 1", "Column 1");
    8
    assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
    8
    assertEquals(96.59363289248458, axis.getLowerBound(), EPSILON);
    8
    assertEquals(axis.getLowerBound(), 95.0, EPSILON);
    Differences
    Expression1Expression2Difference
    96.59363289248458axis.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(207.0529847682752, axis.getUpperBound(), EPSILON);
    9
    assertEquals(207.0529847682752, axis.getUpperBound(), EPSILON);
    9
    assertEquals(axis.getUpperBound(), 205.0, EPSILON);
    Differences
    Expression1Expression2Difference
    207.0529847682752axis.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);
    10
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    10
    DefaultCategoryDataset dataset2 = new DefaultCategoryDataset();
    6
    NumberAxis axis = (NumberAxis)plot.getRangeAxis();
    Differences
    Expression1Expression2Difference
    org.jfree.data.category.DefaultCategoryDatasetorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    dataset2axisVARIABLE_NAME_MISMATCH
    org.jfree.data.category.DefaultCategoryDatasetorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    org.jfree.data.category.DefaultCategoryDatasetorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    new DefaultCategoryDataset()(NumberAxis)plot.getRangeAxis()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression new DefaultCategoryDataset() 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();
    11
    dataset2.setValue(900.0, "Row 1", "Column 1");
    11
    dataset2.setValue(900.0, "Row 1", "Column 1");
    7
    axis.setAutoRangeIncludesZero(false);
    Differences
    Expression1Expression2Difference
    setValuesetAutoRangeIncludesZeroMETHOD_INVOCATION_NAME_MISMATCH
    dataset2axisVARIABLE_NAME_MISMATCH
    org.jfree.data.category.DefaultCategoryDatasetorg.jfree.chart.axis.NumberAxisSUBCLASS_TYPE_MISMATCH
    dataset2.setValue(900.0,"Row 1","Column 1")axis.setAutoRangeIncludesZero(false)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized
    Expression dataset2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression axis cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset2 cannot be unified with expression axis , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setValue(double, Comparable#RAW, Comparable#RAW) , public void setAutoRangeIncludesZero(boolean)
    Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized
    7
    axis.setAutoRangeIncludesZero(false);
    12
    dataset2.setValue(1000.0, "Row 1", "Column 2");
    12
    dataset2.setValue(1000.0, "Row 1", "Column 2");
    13
    plot.setDataset(dataset2);
    13
    plot.setDataset(dataset2);
    14
    assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
    14
    assertEquals(895.2712433374774, axis.getLowerBound(), EPSILON);
    14
    assertEquals(axis.getLowerBound(), 895.0, EPSILON);
    Differences
    Expression1Expression2Difference
    895.2712433374774axis.getLowerBound()TYPE_COMPATIBLE_REPLACEMENT
    axis.getLowerBound()895.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
    14
    assertEquals(axis.getLowerBound(), 895.0, EPSILON);
    15
    assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
    15
    assertEquals(1005.2819262292991, axis.getUpperBound(), EPSILON);
    15
    assertEquals(axis.getUpperBound(), 1005.0, EPSILON);
    Differences
    Expression1Expression2Difference
    1005.2819262292991axis.getUpperBound()TYPE_COMPATIBLE_REPLACEMENT
    axis.getUpperBound()1005.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
    15
    assertEquals(axis.getUpperBound(), 1005.0, EPSILON);
    Precondition Violations (36)
    Row Violation
    1Expression new LogAxis("Log(Y)") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DefaultCategoryDataset() 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 new DefaultCategoryDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
    8Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    9Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression dataset2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression plot cannot be unified with expression dataset2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setRangeAxis(org.jfree.chart.axis.ValueAxis) , public void setValue(double, Comparable#RAW, Comparable#RAW)
    12Expression plot.setRangeAxis(axis) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression plot.setRangeAxis(axis) is a void method call, and thus it cannot be parameterized
    15Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    16Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    20Expression new DefaultCategoryDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression (NumberAxis)plot.getRangeAxis() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    22Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    25Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized
    26Expression dataset2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression axis cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Expression dataset2 cannot be unified with expression axis , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setValue(double, Comparable#RAW, Comparable#RAW) , public void setAutoRangeIncludesZero(boolean)
    29Expression dataset2.setValue(900.0,"Row 1","Column 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    30Expression axis.setAutoRangeIncludesZero(false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    31Expression dataset2.setValue(900.0,"Row 1","Column 1") is a void method call, and thus it cannot be parameterized
    32Expression axis.setAutoRangeIncludesZero(false) is a void method call, and thus it cannot be parameterized
    33Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    34Expression axis.getLowerBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    35Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36Expression axis.getUpperBound() cannot be parameterized, because it has dependencies to/from statements that will be extracted