CategoryPlot plot = new CategoryPlot(); CategoryMarker marker1 = new CategoryMarker("X"); ValueMarker marker2 = new ValueMarker(1.0); plot.addDomainMarker(marker1); plot.addRangeMarker(marker2); EventListener[] listeners1 = marker1.getListeners( MarkerChangeListener.class); assertTrue(Arrays.asList(listeners1).contains(plot)); EventListener[] listeners2 = marker1.getListeners( MarkerChangeListener.class); assertTrue(Arrays.asList(listeners2).contains(plot)); plot.clearDomainMarkers(); plot.clearRangeMarkers(); listeners1 = marker1.getListeners(MarkerChangeListener.class); assertFalse(Arrays.asList(listeners1).contains(plot)); listeners2 = marker1.getListeners(MarkerChangeListener.class); assertFalse(Arrays.asList(listeners2).contains(plot));
XYPlot plot = new XYPlot(); ValueMarker marker1 = new ValueMarker(1.0); ValueMarker marker2 = new ValueMarker(2.0); plot.addDomainMarker(marker1); plot.addRangeMarker(marker2); EventListener[] listeners1 = marker1.getListeners( MarkerChangeListener.class); assertTrue(Arrays.asList(listeners1).contains(plot)); EventListener[] listeners2 = marker1.getListeners( MarkerChangeListener.class); assertTrue(Arrays.asList(listeners2).contains(plot)); plot.clearDomainMarkers(); plot.clearRangeMarkers(); listeners1 = marker1.getListeners(MarkerChangeListener.class); assertFalse(Arrays.asList(listeners1).contains(plot)); listeners2 = marker1.getListeners(MarkerChangeListener.class); assertFalse(Arrays.asList(listeners2).contains(plot));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MarkerTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MarkerTests.java
Method name: void testListenersWithCategoryPlot() Method name: void testListenersWithXYPlot()
Number of AST nodes: 15 Number of AST nodes: 15
1
CategoryPlot plot = new CategoryPlot();
1
XYPlot plot = new XYPlot();
2
        CategoryMarker marker1 = new CategoryMarker("X");
2
        ValueMarker marker1 = new ValueMarker(1.0);
3
        ValueMarker marker2 = new ValueMarker(1.0);
3
        ValueMarker marker2 = new ValueMarker(2.0);
4
        plot.addDomainMarker(marker1);
4
        plot.addDomainMarker(marker1);
5
        plot.addRangeMarker(marker2);
5
        plot.addRangeMarker(marker2);
6
        EventListener[] listeners1 = marker1.getListeners(
6
        EventListener[] listeners1 = marker1.getListeners(
7
                MarkerChangeListener.class);
7
                MarkerChangeListener.class);
8
        assertTrue(Arrays.asList(listeners1).contains(plot));
8
        assertTrue(Arrays.asList(listeners1).contains(plot));
9
        EventListener[] listeners2 = marker1.getListeners(
9
        EventListener[] listeners2 = marker1.getListeners(
10
                MarkerChangeListener.class);
10
                MarkerChangeListener.class);
11
        assertTrue(Arrays.asList(listeners2).contains(plot));
11
        assertTrue(Arrays.asList(listeners2).contains(plot));
12
        plot.clearDomainMarkers();
12
        plot.clearDomainMarkers();
13
        plot.clearRangeMarkers();
13
        plot.clearRangeMarkers();
14
        listeners1 = marker1.getListeners(MarkerChangeListener.class);
14
        listeners1 = marker1.getListeners(MarkerChangeListener.class);
15
        assertFalse(Arrays.asList(listeners1).contains(plot));
15
        assertFalse(Arrays.asList(listeners1).contains(plot));
16
        listeners2 = marker1.getListeners(MarkerChangeListener.class);
16
        listeners2 = marker1.getListeners(MarkerChangeListener.class);
17
        assertFalse(Arrays.asList(listeners2).contains(plot));
17
        assertFalse(Arrays.asList(listeners2).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 declared in the same class
Number of node comparisons108
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    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
    ValueMarker marker1 = new ValueMarker(1.0);
    Preondition Violations
    Unmatched statement ValueMarker marker1=new ValueMarker(1.0); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    ValueMarker marker1 = new ValueMarker(1.0);
    2
    CategoryMarker marker1 = new CategoryMarker("X");
    2
    CategoryMarker marker1 = new CategoryMarker("X");
    Preondition Violations
    Unmatched statement CategoryMarker marker1=new CategoryMarker("X"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                        
    3
    ValueMarker marker2 = new ValueMarker(1.0);
    3
    ValueMarker marker2 = new ValueMarker(1.0);
    3
    ValueMarker marker2 = new ValueMarker(2.0);
    Differences
    Expression1Expression2Difference
    1.02.0LITERAL_VALUE_MISMATCH
    3
    ValueMarker marker2 = new ValueMarker(2.0);
    4
    plot.addDomainMarker(marker1);
    4
    plot.addDomainMarker(marker1);
    4
    plot.addDomainMarker(marker1);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression marker1 cannot be unified with expression marker1 , because common superclass type org.jfree.chart.plot.Marker cannot be passed as an argument to public void addDomainMarker(org.jfree.chart.plot.CategoryMarker)
    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 addDomainMarker(org.jfree.chart.plot.Marker)
    4
    plot.addDomainMarker(marker1);
    5
    plot.addRangeMarker(marker2);
    5
    plot.addRangeMarker(marker2);
    5
    plot.addRangeMarker(marker2);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void addRangeMarker(org.jfree.chart.plot.Marker)
    5
    plot.addRangeMarker(marker2);
    6
    EventListener[] listeners1 = marker1.getListeners(MarkerChangeListener.class);
    6
    EventListener[] listeners1 = marker1.getListeners(MarkerChangeListener.class);
    6
    EventListener[] listeners1 = marker1.getListeners(MarkerChangeListener.class);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    6
    EventListener[] listeners1 = marker1.getListeners(MarkerChangeListener.class);
    7
    assertTrue(Arrays.asList(listeners1).contains(plot));
    7
    assertTrue(Arrays.asList(listeners1).contains(plot));
    7
    assertTrue(Arrays.asList(listeners1).contains(plot));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    7
    assertTrue(Arrays.asList(listeners1).contains(plot));
    8
    EventListener[] listeners2 = marker1.getListeners(MarkerChangeListener.class);
    8
    EventListener[] listeners2 = marker1.getListeners(MarkerChangeListener.class);
    8
    EventListener[] listeners2 = marker1.getListeners(MarkerChangeListener.class);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    8
    EventListener[] listeners2 = marker1.getListeners(MarkerChangeListener.class);
    9
    assertTrue(Arrays.asList(listeners2).contains(plot));
    9
    assertTrue(Arrays.asList(listeners2).contains(plot));
    9
    assertTrue(Arrays.asList(listeners2).contains(plot));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    9
    assertTrue(Arrays.asList(listeners2).contains(plot));
    10
    plot.clearDomainMarkers();
    10
    plot.clearDomainMarkers();
    10
    plot.clearDomainMarkers();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void clearDomainMarkers()
    10
    plot.clearDomainMarkers();
    11
    plot.clearRangeMarkers();
    11
    plot.clearRangeMarkers();
    11
    plot.clearRangeMarkers();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void clearRangeMarkers()
    11
    plot.clearRangeMarkers();
    12
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    12
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    12
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    12
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    13
    assertFalse(Arrays.asList(listeners1).contains(plot));
    13
    assertFalse(Arrays.asList(listeners1).contains(plot));
    13
    assertFalse(Arrays.asList(listeners1).contains(plot));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    13
    assertFalse(Arrays.asList(listeners1).contains(plot));
    14
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    14
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    14
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.chart.plot.ValueMarkerSUBCLASS_TYPE_MISMATCH
    14
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    15
    assertFalse(Arrays.asList(listeners2).contains(plot));
    15
    assertFalse(Arrays.asList(listeners2).contains(plot));
    15
    assertFalse(Arrays.asList(listeners2).contains(plot));
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryPlotorg.jfree.chart.plot.XYPlotSUBCLASS_TYPE_MISMATCH
    15
    assertFalse(Arrays.asList(listeners2).contains(plot));
    Precondition Violations (9)
    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 ValueMarker marker1=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 marker1=new CategoryMarker("X"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Expression marker1 cannot be unified with expression marker1 , because common superclass type org.jfree.chart.plot.Marker cannot be passed as an argument to public void addDomainMarker(org.jfree.chart.plot.CategoryMarker)
    6Expression 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 addDomainMarker(org.jfree.chart.plot.Marker)
    7Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void addRangeMarker(org.jfree.chart.plot.Marker)
    8Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void clearDomainMarkers()
    9Expression plot cannot be unified with expression plot , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void clearRangeMarkers()