218-4-6

XIntervalSeries s1 = new XIntervalSeries("s1"); s1.add(1.0, 0.5, 1.5, 2.0); XIntervalSeries s2 = null; try { s2 = (XIntervalSeries) s1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(s1 != s2); assertTrue(s1.getClass() == s2.getClass()); assertTrue(s1.equals(s2));
XYIntervalSeries s1 = new XYIntervalSeries("s1"); s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01); XYIntervalSeries s2 = null; try { s2 = (XYIntervalSeries) s1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(s1 != s2); assertTrue(s1.getClass() == s2.getClass()); assertTrue(s1.equals(s2));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XIntervalSeriesTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYIntervalSeriesTests.java
Method name: `void testCloning()` |  | Method name: `void testCloning()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

    XIntervalSeries s1 = new XIntervalSeries("s1");↵

1

    XYIntervalSeries s1 = new XYIntervalSeries("s1");↵

2

            s1.add(1.0, 0.5, 1.5, 2.0);↵

2

            s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01);↵

3

            XIntervalSeries s2 = null;↵

3

            XYIntervalSeries s2 = null;↵

4

            try {↵

4

            try {↵

5

                s2 = (XIntervalSeries) s1.clone();↵

5

                s2 = (XYIntervalSeries) s1.clone();↵

6

            }↵

6

            }↵

7

            catch (CloneNotSupportedException e) {↵

7

            catch (CloneNotSupportedException e) {↵

8

                e.printStackTrace();↵

8

                e.printStackTrace();↵

9

            }↵

9

            }↵

10

            assertTrue(s1 != s2);↵

10

            assertTrue(s1 != s2);↵

11

            assertTrue(s1.getClass() == s2.getClass());↵

11

            assertTrue(s1.getClass() == s2.getClass());↵

12

            assertTrue(s1.equals(s2));

12

            assertTrue(s1.equals(s2));

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.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 24

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) | 18.5
   Clone type | Type 2

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

   1

       XIntervalSeries s1 = new XIntervalSeries("s1");

   1

       XYIntervalSeries s1 = new XYIntervalSeries("s1");

   2

       s1.add(1.0, 0.5, 1.5, 2.0);

   2 | s1.add(1.0, 0.5, 1.5, 2.0);
   2 | s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   s1.add(1.0,0.5,1.5,2.0) | s1.add(1.0,0.5,1.5,2.0,1.9,2.01) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression s1.add(1.0,0.5,1.5,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s1.add(1.0,0.5,1.5,2.0,1.9,2.01) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s1.add(1.0,0.5,1.5,2.0) is a void method call, and thus it cannot be parameterized
   Expression s1.add(1.0,0.5,1.5,2.0,1.9,2.01) is a void method call, and thus it cannot be parameterized

   2

       s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01);

   3

       XIntervalSeries s2 = null;

   3

       XYIntervalSeries s2 = null;

   4

       try

   4

       try

   5

       s2 = (XIntervalSeries)s1.clone();

   5

       s2 = (XYIntervalSeries)s1.clone();

   6

       assertTrue(s1 != s2);

   6

       assertTrue(s1 != s2);

   7

       assertTrue(s1.getClass() == s2.getClass());

   7

       assertTrue(s1.getClass() == s2.getClass());

   8

       assertTrue(s1.equals(s2));

   8

       assertTrue(s1.equals(s2));

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression s1.add(1.0,0.5,1.5,2.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression s1.add(1.0,0.5,1.5,2.0,1.9,2.01) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression s1.add(1.0,0.5,1.5,2.0) is a void method call, and thus it cannot be parameterized
   4 | Expression s1.add(1.0,0.5,1.5,2.0,1.9,2.01) is a void method call, and thus it cannot be parameterized