CategoryPlot plot = new CategoryPlot(); CategoryMarker m = new CategoryMarker("C1"); plot.addDomainMarker(m); List listeners = Arrays.asList(m.getListeners( MarkerChangeListener.class)); assertTrue(listeners.contains(plot)); plot.clearDomainMarkers(); listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class)); assertFalse(listeners.contains(plot));
XYPlot plot = new XYPlot(); Marker m = new ValueMarker(1.0); plot.addRangeMarker(m); List listeners = Arrays.asList(m.getListeners( MarkerChangeListener.class)); assertTrue(listeners.contains(plot)); plot.clearRangeMarkers(); listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class)); assertFalse(listeners.contains(plot));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CategoryPlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java
Method name: void testAddDomainMarker() Method name: void testAddRangeMarker()
Number of AST nodes: 8 Number of AST nodes: 8
1
CategoryPlot plot = new CategoryPlot();
1
XYPlot plot = new XYPlot();
2
        CategoryMarker m = new CategoryMarker("C1");
2
        Marker m = new ValueMarker(1.0);
3
        plot.addDomainMarker(m);
3
        plot.addRangeMarker(m);
4
        List listeners = Arrays.asList(m.getListeners(
4
        List listeners = Arrays.asList(m.getListeners(
5
                MarkerChangeListener.class));
5
                MarkerChangeListener.class));
6
        assertTrue(listeners.contains(plot));
6
        assertTrue(listeners.contains(plot));
7
        plot.clearDomainMarkers();
7
        plot.clearRangeMarkers();
8
        listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
8
        listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
9
        assertFalse(listeners.contains(plot));
9
        assertFalse(listeners.contains(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 comparisons34
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    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
    CategoryPlot plot = new CategoryPlot();
    1
    CategoryPlot plot = new CategoryPlot();
    1
    XYPlot plot = new XYPlot();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new CategoryPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    XYPlot plot = new XYPlot();
                                                                      
    2
    Marker m = new ValueMarker(1.0);
    Preondition Violations
    Unmatched statement Marker m=new ValueMarker(1.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    Marker m = new ValueMarker(1.0);
    2
    CategoryMarker m = new CategoryMarker("C1");
    2
    CategoryMarker m = new CategoryMarker("C1");
    Preondition Violations
    Unmatched statement CategoryMarker m=new CategoryMarker("C1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                              
    3
    plot.addDomainMarker(m);
    3
    plot.addDomainMarker(m);
    3
    plot.addRangeMarker(m);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.MarkerSUBCLASS_TYPE_MISMATCH
    addDomainMarkeraddRangeMarkerMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot.addDomainMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.addRangeMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.addDomainMarker(m) is a void method call, and thus it cannot be parameterized
    Expression plot.addRangeMarker(m) is a void method call, and thus it cannot be parameterized
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void addDomainMarker(org.jfree.chart.plot.CategoryMarker) , public void addRangeMarker(org.jfree.chart.plot.Marker)
    3
    plot.addRangeMarker(m);
    4
    List listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    4
    List listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    4
    List listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.MarkerSUBCLASS_TYPE_MISMATCH
    4
    List listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    5
    assertTrue(listeners.contains(plot));
    5
    assertTrue(listeners.contains(plot));
    5
    assertTrue(listeners.contains(plot));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    5
    assertTrue(listeners.contains(plot));
    6
    plot.clearDomainMarkers();
    6
    plot.clearDomainMarkers();
    6
    plot.clearRangeMarkers();
    Differences
    Expression1Expression2Difference
    clearDomainMarkersclearRangeMarkersMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot.clearDomainMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.clearRangeMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.clearDomainMarkers() is a void method call, and thus it cannot be parameterized
    Expression plot.clearRangeMarkers() is a void method call, and thus it cannot be parameterized
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void clearDomainMarkers() , public void clearRangeMarkers()
    6
    plot.clearRangeMarkers();
    7
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    7
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    7
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.MarkerSUBCLASS_TYPE_MISMATCH
    7
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    8
    assertFalse(listeners.contains(plot));
    8
    assertFalse(listeners.contains(plot));
    8
    assertFalse(listeners.contains(plot));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    8
    assertFalse(listeners.contains(plot));
    Precondition Violations (14)
    Row Violation
    1Expression new CategoryPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new XYPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement Marker m=new ValueMarker(1.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Unmatched statement CategoryMarker m=new CategoryMarker("C1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Expression plot.addDomainMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression plot.addRangeMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression plot.addDomainMarker(m) is a void method call, and thus it cannot be parameterized
    8Expression plot.addRangeMarker(m) is a void method call, and thus it cannot be parameterized
    9Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void addDomainMarker(org.jfree.chart.plot.CategoryMarker) , public void addRangeMarker(org.jfree.chart.plot.Marker)
    10Expression plot.clearDomainMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression plot.clearRangeMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression plot.clearDomainMarkers() is a void method call, and thus it cannot be parameterized
    13Expression plot.clearRangeMarkers() is a void method call, and thus it cannot be parameterized
    14Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void clearDomainMarkers() , public void clearRangeMarkers()