218-1-6

MatrixSeries m1 = new MatrixSeries("Test", 8, 3); m1.update(0, 0, 11.0); m1.update(7, 2, 22.0); MatrixSeries m2 = null; try { m2 = (MatrixSeries) m1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(m1 != m2); assertTrue(m1.getClass() == m2.getClass()); assertTrue(m1.equals(m2));
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/MatrixSeriesTests.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: 9 |  | Number of AST nodes: 8

1

    MatrixSeries m1 = new MatrixSeries("Test", 8, 3);↵

1

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

2

            m1.update(0, 0, 11.0);↵

2

            s1.add(1.0, 0.5, 1↵

3

            m1.update(7, 2, 22.0);↵

3

    .5, 2.0, 1.9, 2.01);↵

4

            MatrixSeries m2 = null;↵

4

            XYIntervalSeries s2 = null;↵

5

            try {↵

5

            try {↵

6

                m2 = (MatrixSeries) m1.clone();↵

6

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

7

            }↵

7

            }↵

8

            catch (CloneNotSupportedException e) {↵

8

            catch (CloneNotSupportedException e) {↵

9

                e.printStackTrace();↵

9

                e.printStackTrace();↵

10

            }↵

10

            }↵

11

            assertTrue(m1 != m2);↵

11

            assertTrue(s1 != s2);↵

12

            assertTrue(m1.getClass() == m2.getClass());↵

12

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

13

            assertTrue(m1.equals(m2));

13

            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 | 36

1. {Non-refactorable}

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

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

   1

       MatrixSeries m1 = new MatrixSeries("Test", 8, 3);

   1 | MatrixSeries m1 = new MatrixSeries("Test", 8, 3);
   1 | XYIntervalSeries s1 = new XYIntervalSeries("s1");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   m1 | s1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   new MatrixSeries("Test",8,3) | new XYIntervalSeries("s1") | ARGUMENT_NUMBER_MISMATCH

   1

       XYIntervalSeries s1 = new XYIntervalSeries("s1");

   2

       m1.update(0, 0, 11.0);

   2 | m1.update(0, 0, 11.0);
   2 | s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   update | add | METHOD_INVOCATION_NAME_MISMATCH
   m1 | s1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   m1.update(0,0,11.0) | s1.add(1.0,0.5,1.5,2.0,1.9,2.01) | ARGUMENT_NUMBER_MISMATCH

   Preondition Violations
   Expression m1.update(0,0,11.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 m1.update(0,0,11.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
   Expression m1.update(0,0,11.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 m1.update(0,0,11.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

       m1.update(7, 2, 22.0);

   4

       MatrixSeries m2 = null;

   4 | MatrixSeries m2 = null;
   3 | XYIntervalSeries s2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   m2 | s2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH

   3

       XYIntervalSeries s2 = null;

   5

       try

   4

       try

   6

       m2 = (MatrixSeries)m1.clone();

   6 | m2 = (MatrixSeries)m1.clone();
   5 | s2 = (XYIntervalSeries)s1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m2 | s2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   m1 | s1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH

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

   5

       s2 = (XYIntervalSeries)s1.clone();

   7

       assertTrue(m1 != m2);

   7 | assertTrue(m1 != m2);
   6 | assertTrue(s1 != s2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   m1 | s1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH
   m2 | s2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.MatrixSeries | org.jfree.data.xy.XYIntervalSeries | SUBCLASS_TYPE_MISMATCH

   6

       assertTrue(s1 != s2);

   8

       assertTrue(m1.getClass() == m2.getClass());

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

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

   Preondition Violations
   Expression m1.getClass() == m2.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));

   9

       assertTrue(m1.equals(m2));

   9 | assertTrue(m1.equals(m2));
   7 | assertTrue(s1.getClass() == s2.getClass());

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

   Preondition Violations
   Expression m1.equals(m2) 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 (15)
   Row | Violation
   --- | ---
   1 | Expression m1.update(0,0,11.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 m1.update(0,0,11.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
   5 | Expression m1.update(0,0,11.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | 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
   7 | Expression m1.update(0,0,11.0) is a void method call, and thus it cannot be parameterized
   8 | 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
   9 | Expression (MatrixSeries)m1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   10 | Expression (XYIntervalSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression m1.getClass() == m2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   12 | Expression s1.equals(s2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   13 | Expression m1.equals(m2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   14 | Expression s1.getClass() == s2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   15 | Clone fragment #1 returns variables m1 , while Clone fragment #2 returns variables