376-2-3

XYPlot plot = new XYPlot(); Marker m = new ValueMarker(1.0); 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/XYPlotTests.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

    XYPlot plot = new XYPlot();↵

1

    XYPlot plot = new XYPlot();↵

2

            Marker m = new ValueMarker(1.0);↵

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));

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0
Clones location | Clones are declared in the same class
Number of node comparisons | 29

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.0
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       XYPlot plot = new XYPlot();

   1

       XYPlot plot = new XYPlot();

   2

       Marker m = new ValueMarker(1.0);

   2

       Marker m = new ValueMarker(1.0);

   3

       plot.addDomainMarker(m);

   3 | plot.addDomainMarker(m);
   3 | plot.addRangeMarker(m);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   addDomainMarker | addRangeMarker | METHOD_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));

   5

       assertTrue(listeners.contains(plot));

   5

       assertTrue(listeners.contains(plot));

   6

       plot.clearDomainMarkers();

   6 | plot.clearDomainMarkers();
   6 | plot.clearRangeMarkers();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   clearDomainMarkers | clearRangeMarkers | METHOD_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));

   8

       assertFalse(listeners.contains(plot));

   8

       assertFalse(listeners.contains(plot));

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Expression plot.addDomainMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression plot.addRangeMarker(m) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression plot.addDomainMarker(m) is a void method call, and thus it cannot be parameterized
   4 | Expression plot.addRangeMarker(m) is a void method call, and thus it cannot be parameterized
   5 | Expression plot.clearDomainMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression plot.clearRangeMarkers() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression plot.clearDomainMarkers() is a void method call, and thus it cannot be parameterized
   8 | Expression plot.clearRangeMarkers() is a void method call, and thus it cannot be parameterized