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));
CategoryPlot plot = new CategoryPlot(); 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/CategoryPlotTests.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
CategoryPlot plot = new CategoryPlot();
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 cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones locationClones are declared in the same class
Number of node comparisons34
  1. {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();
                                                                      
    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
    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
    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));
    6
    plot.clearDomainMarkers();
    6
    plot.clearDomainMarkers();
    6
    plot.clearRangeMarkers();
    Differences
    Expression1Expression2Difference
    clearDomainMarkersclearRangeMarkersMETHOD_INVOCATION_NAME_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
    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));
    Precondition Violations (10)
    Row Violation
    1Unmatched 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
    2Unmatched statement CategoryMarker m=new CategoryMarker("C1"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Expression plot.addDomainMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression plot.addRangeMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression plot.addDomainMarker(m) is a void method call, and thus it cannot be parameterized
    6Expression plot.addRangeMarker(m) is a void method call, and thus it cannot be parameterized
    7Expression plot.clearDomainMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression plot.clearRangeMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression plot.clearDomainMarkers() is a void method call, and thus it cannot be parameterized
    10Expression plot.clearRangeMarkers() is a void method call, and thus it cannot be parameterized