XYDataset data1 = createDataset1(); XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis rangeAxis1 = new NumberAxis("Range 1"); XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); // create subplot 2... XYDataset data2 = createDataset2(); XYItemRenderer renderer2 = new StandardXYItemRenderer(); NumberAxis rangeAxis2 = new NumberAxis("Range 2"); rangeAxis2.setAutoRangeIncludesZero(false); XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); return plot;
XYDataset data1 = createDataset1(); XYItemRenderer renderer1 = new StandardXYItemRenderer(); NumberAxis xAxis1 = new NumberAxis("X1"); XYPlot subplot1 = new XYPlot(data1, xAxis1, null, renderer1); subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0); annotation.setFont(new Font("SansSerif", Font.PLAIN, 9)); annotation.setRotationAngle(Math.PI / 4.0); subplot1.addAnnotation(annotation); // create subplot 2... XYDataset data2 = createDataset2(); XYItemRenderer renderer2 = new StandardXYItemRenderer(); NumberAxis xAxis2 = new NumberAxis("X2"); xAxis2.setAutoRangeIncludesZero(false); XYPlot subplot2 = new XYPlot(data2, xAxis2, null, renderer2); subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); // parent plot... CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis( "Range")); plot.setGap(10.0); // add the subplots... plot.add(subplot1, 1); plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.VERTICAL); return plot;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CombinedDomainXYPlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CombinedRangeXYPlotTests.java
Method name: CombinedDomainXYPlot createPlot() Method name: CombinedRangeXYPlot createPlot()
Number of AST nodes: 21 Number of AST nodes: 21
1
XYDataset data1 = createDataset1();
1
XYDataset data1 = createDataset1();
2
        XYItemRenderer renderer1 = new StandardXYItemRenderer();
2
        XYItemRenderer renderer1 = new StandardXYItemRenderer();
3
        NumberAxis rangeAxis1 = new NumberAxis("Range 1");
3
        NumberAxis xAxis1 = new NumberAxis("X1");
4
        XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
4
        XYPlot subplot1 = new XYPlot(data1, xAxis1, null, renderer1);
5
        subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
5
        subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
6
        
6
         
7
        XYTextAnnotation annotation 
7
        XYTextAnnotation annotation 
8
            = new XYTextAnnotation("Hello!", 50.0, 10000.0);
8
                = new XYTextAnnotation("Hello!", 50.0, 10000.0);
9
        annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
9
        annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
10
        annotation.setRotationAngle(Math.PI / 4.0);
10
        annotation.setRotationAngle(Math.PI / 4.0);
11
        subplot1.addAnnotation(annotation);
11
        subplot1.addAnnotation(annotation);
12
        
12
         
13
        // create subplot 2...
13
        // create subplot 2...
14
        XYDataset data2 = createDataset2();
14
        XYDataset data2 = createDataset2();
15
        XYItemRenderer renderer2 = new StandardXYItemRenderer();
15
        XYItemRenderer renderer2 = new StandardXYItemRenderer();
16
        NumberAxis rangeAxis2 = new NumberAxis("Range 2");
16
        NumberAxis xAxis2 = new NumberAxis("X2");
17
        rangeAxis2.setAutoRangeIncludesZero(false);
17
        xAxis2.setAutoRangeIncludesZero(false);
18
        XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
18
        XYPlot subplot2 = new XYPlot(data2, xAxis2, null, renderer2);
19
        subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
19
        subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT); 
20
        // parent plot...
20
        // parent plot...
21
        CombinedDomainXYPlot plot 
21
        CombinedRangeXYPlot plot 
22
            = new CombinedDomainXYPlot(new NumberAxis("Domain
22
= new CombinedRangeXYPlot(new NumberAxis(
23
"));
23
                "Range"));
24
        plot.setGap(10.0);
24
        plot.setGap(10.0);
25
        
25
        
26
        // add the subplots...
26
        // add the subplots...
27
        plot.add(subplot1, 1);
27
        plot.add(subplot1, 1);
28
        plot.add(subplot2, 1);
28
        plot.add(subplot2, 1);
29
        plot.setOrientation(PlotOrientation.VERTICAL);
29
        plot.setOrientation(PlotOrientation.VERTICAL);
30
        return plot;
30
        return plot;
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 comparisons174
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements21
    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
    XYDataset data1 = createDataset1();
    1
    XYDataset data1 = createDataset1();
    2
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    2
    XYItemRenderer renderer1 = new StandardXYItemRenderer();
    3
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    3
    NumberAxis rangeAxis1 = new NumberAxis("Range 1");
    3
    NumberAxis xAxis1 = new NumberAxis("X1");
    Differences
    Expression1Expression2Difference
    rangeAxis1xAxis1VARIABLE_NAME_MISMATCH
    "Range 1""X1"LITERAL_VALUE_MISMATCH
    3
    NumberAxis xAxis1 = new NumberAxis("X1");
    4
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    4
    XYPlot subplot1 = new XYPlot(data1, null, rangeAxis1, renderer1);
    4
    XYPlot subplot1 = new XYPlot(data1, xAxis1, null, renderer1);
    Differences
    Expression1Expression2Difference
    nullxAxis1TYPE_COMPATIBLE_REPLACEMENT
    rangeAxis1nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression xAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rangeAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    XYPlot subplot1 = new XYPlot(data1, xAxis1, null, renderer1);
    5
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    5
    subplot1.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
    6
    XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    6
    XYTextAnnotation annotation = new XYTextAnnotation("Hello!", 50.0, 10000.0);
    7
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    7
    annotation.setFont(new Font("SansSerif", Font.PLAIN, 9));
    8
    annotation.setRotationAngle(Math.PI / 4.0);
    8
    annotation.setRotationAngle(Math.PI / 4.0);
    9
    subplot1.addAnnotation(annotation);
    9
    subplot1.addAnnotation(annotation);
    10
    XYDataset data2 = createDataset2();
    10
    XYDataset data2 = createDataset2();
    11
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    11
    XYItemRenderer renderer2 = new StandardXYItemRenderer();
    12
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    12
    NumberAxis rangeAxis2 = new NumberAxis("Range 2");
    12
    NumberAxis xAxis2 = new NumberAxis("X2");
    Differences
    Expression1Expression2Difference
    rangeAxis2xAxis2VARIABLE_NAME_MISMATCH
    "Range 2""X2"LITERAL_VALUE_MISMATCH
    12
    NumberAxis xAxis2 = new NumberAxis("X2");
    13
    rangeAxis2.setAutoRangeIncludesZero(false);
    13
    rangeAxis2.setAutoRangeIncludesZero(false);
    13
    xAxis2.setAutoRangeIncludesZero(false);
    Differences
    Expression1Expression2Difference
    rangeAxis2xAxis2VARIABLE_NAME_MISMATCH
    13
    xAxis2.setAutoRangeIncludesZero(false);
    14
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    14
    XYPlot subplot2 = new XYPlot(data2, null, rangeAxis2, renderer2);
    14
    XYPlot subplot2 = new XYPlot(data2, xAxis2, null, renderer2);
    Differences
    Expression1Expression2Difference
    nullxAxis2TYPE_COMPATIBLE_REPLACEMENT
    rangeAxis2nullTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression xAxis2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression rangeAxis2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    XYPlot subplot2 = new XYPlot(data2, xAxis2, null, renderer2);
    15
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    15
    subplot2.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);
    16
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    16
    CombinedDomainXYPlot plot = new CombinedDomainXYPlot(new NumberAxis("Domain"));
    16
    CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis("Range"));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    "Domain""Range"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression new CombinedDomainXYPlot(new NumberAxis("Domain")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new CombinedRangeXYPlot(new NumberAxis("Range")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16
    CombinedRangeXYPlot plot = new CombinedRangeXYPlot(new NumberAxis("Range"));
    17
    plot.setGap(10.0);
    17
    plot.setGap(10.0);
    17
    plot.setGap(10.0);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.XYPlot does not declare member(s) public void setGap(double)
    17
    plot.setGap(10.0);
    18
    plot.add(subplot1, 1);
    18
    plot.add(subplot1, 1);
    18
    plot.add(subplot1, 1);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.XYPlot does not declare member(s) public void add(org.jfree.chart.plot.XYPlot, int)
    18
    plot.add(subplot1, 1);
    19
    plot.add(subplot2, 1);
    19
    plot.add(subplot2, 1);
    19
    plot.add(subplot2, 1);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.XYPlot does not declare member(s) public void add(org.jfree.chart.plot.XYPlot, int)
    19
    plot.add(subplot2, 1);
    20
    plot.setOrientation(PlotOrientation.VERTICAL);
    20
    plot.setOrientation(PlotOrientation.VERTICAL);
    20
    plot.setOrientation(PlotOrientation.VERTICAL);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    20
    plot.setOrientation(PlotOrientation.VERTICAL);
    21
    return plot;
    21
    return plot;
    21
    return plot;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CombinedDomainXYPlotorg.jfree.chart.plot.CombinedRangeXYPlotSUBCLASS_TYPE_MISMATCH
    21
    return plot;
    Precondition Violations (9)
    Row Violation
    1Expression xAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression rangeAxis1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression xAxis2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression rangeAxis2 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression new CombinedDomainXYPlot(new NumberAxis("Domain")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression new CombinedRangeXYPlot(new NumberAxis("Range")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.XYPlot does not declare member(s) public void setGap(double)
    8Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.XYPlot does not declare member(s) public void add(org.jfree.chart.plot.XYPlot, int)
    9Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.XYPlot does not declare member(s) public void add(org.jfree.chart.plot.XYPlot, int)