218-2-3

VectorSeries s1 = new VectorSeries("s1"); s1.add(1.0, 0.5, 1.5, 2.0); VectorSeries s2 = null; try { s2 = (VectorSeries) s1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(s1 != s2); assertTrue(s1.getClass() == s2.getClass()); assertTrue(s1.equals(s2));
YIntervalSeries s1 = new YIntervalSeries("s1"); s1.add(1.0, 0.5, 1.5, 2.0); YIntervalSeries s2 = null; try { s2 = (YIntervalSeries) 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/VectorSeriesTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/YIntervalSeriesTests.java
Method name: `void testCloning()` |  | Method name: `void testCloning()`
Number of AST nodes: 8 |  | Number of AST nodes: 8

1

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

1

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

2

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

2

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

3

            VectorSeries s2 = null;↵

3

            YIntervalSeries s2 = null;↵

4

            try {↵

4

            try {↵

5

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

5

                s2 = (YIntervalSeries) 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) | 6.9
   Clone type | Type 2

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

   1

       VectorSeries s1 = new VectorSeries("s1");

   1 | VectorSeries s1 = new VectorSeries("s1");
   1 | YIntervalSeries s1 = new YIntervalSeries("s1");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   1

       YIntervalSeries s1 = new YIntervalSeries("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);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.ComparableObjectSeries does not declare member(s) public void add(double, double, double, double)

   2

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

   3

       VectorSeries s2 = null;

   3 | VectorSeries s2 = null;
   3 | YIntervalSeries s2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   3

       YIntervalSeries s2 = null;

   4

       try

   4

       try

   5

       s2 = (VectorSeries)s1.clone();

   5 | s2 = (VectorSeries)s1.clone();
   5 | s2 = (YIntervalSeries)s1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (VectorSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (YIntervalSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   5

       s2 = (YIntervalSeries)s1.clone();

   6

       assertTrue(s1 != s2);

   6 | assertTrue(s1 != s2);
   6 | assertTrue(s1 != s2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   6

       assertTrue(s1 != s2);

   7

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

   7 | assertTrue(s1.getClass() == s2.getClass());
   8 | assertTrue(s1.equals(s2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   s1.getClass() == s2.getClass() | s1.equals(s2) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression s1.getClass() == s2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s1.equals(s2) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   8

       assertTrue(s1.equals(s2));

   8

       assertTrue(s1.equals(s2));

   8 | assertTrue(s1.equals(s2));
   7 | assertTrue(s1.getClass() == s2.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   s1.equals(s2) | s1.getClass() == s2.getClass() | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression s1.equals(s2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression s1.getClass() == s2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

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

   Precondition Violations (7)
   Row | Violation
   --- | ---
   1 | Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.ComparableObjectSeries does not declare member(s) public void add(double, double, double, double)
   2 | Expression (VectorSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression (YIntervalSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression s1.getClass() == s2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression s1.equals(s2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression s1.equals(s2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression s1.getClass() == s2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted