218-14-15

CombinedDomainXYPlot plot1 = createPlot(); CombinedDomainXYPlot plot2 = null; try { plot2 = (CombinedDomainXYPlot) plot1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(plot1 != plot2); assertTrue(plot1.getClass() == plot2.getClass()); assertTrue(plot1.equals(plot2));
CombinedRangeXYPlot plot1 = createPlot(); CombinedRangeXYPlot plot2 = null; try { plot2 = (CombinedRangeXYPlot) plot1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(plot1 != plot2); assertTrue(plot1.getClass() == plot2.getClass()); assertTrue(plot1.equals(plot2));

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: `void testCloning()` |  | Method name: `void testCloning()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    CombinedDomainXYPlot plot1 = createPlot();        ↵

1

    CombinedRangeXYPlot plot1 = createPlot();        ↵

2

            CombinedDomainXYPlot plot2 = null;↵

2

            CombinedRangeXYPlot plot2 = null;↵

3

            try {↵

3

            try {↵

4

                plot2 = (CombinedDomainXYPlot) plot1.clone();↵

4

                plot2 = (CombinedRangeXYPlot) plot1.clone();↵

5

            }↵

5

            }↵

6

            catch (CloneNotSupportedException e) {↵

6

            catch (CloneNotSupportedException e) {↵

7

                e.printStackTrace();↵

7

                e.printStackTrace();↵

8

            }↵

8

            }↵

9

            assertTrue(plot1 != plot2);↵

9

            assertTrue(plot1 != plot2);↵

10

            assertTrue(plot1.getClass() == plot2.getClass());↵

10

            assertTrue(plot1.getClass() == plot2.getClass());↵

11

            assertTrue(plot1.equals(plot2));

11

            assertTrue(plot1.equals(plot2));

See real code fragment |  | See real code fragment

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 7
   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) | 1.3
   Clone type | Type 1

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

   1

       CombinedDomainXYPlot plot1 = createPlot();

   1

       CombinedRangeXYPlot plot1 = createPlot();

   2

       CombinedDomainXYPlot plot2 = null;

   2

       CombinedRangeXYPlot plot2 = null;

   3

       try

   3

       try

   4

       plot2 = (CombinedDomainXYPlot)plot1.clone();

   4

       plot2 = (CombinedRangeXYPlot)plot1.clone();

   5

       assertTrue(plot1 != plot2);

   5

       assertTrue(plot1 != plot2);

   6

       assertTrue(plot1.getClass() == plot2.getClass());

   6

       assertTrue(plot1.getClass() == plot2.getClass());

   7

       assertTrue(plot1.equals(plot2));

   7

       assertTrue(plot1.equals(plot2));

   Precondition Violations (0)
   Row | Violation
   --- | ---