229-33-41

VectorDataItem v1 = new VectorDataItem(1.0, 2.0, 3.0, 4.0); VectorDataItem v2 = null; try { v2 = (VectorDataItem) v1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(v1 != v2); assertTrue(v1.getClass() == v2.getClass()); assertTrue(v1.equals(v2));
XIntervalDataItem item1 = new XIntervalDataItem(1.0, 2.0, 3.0, 4.0); XIntervalDataItem item2 = null; try { item2 = (XIntervalDataItem) item1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(item1 != item2); assertTrue(item1.getClass() == item2.getClass()); assertTrue(item1.equals(item2));

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

1

    VectorDataItem v1 = new VectorDataItem(1.0, 2.0, 3.0, 4.0);↵

1

    XIntervalDataItem item1 = new XIntervalDataItem(1.0, 2.0, 3.0, 4.0);↵

2

            VectorDataItem v2 = null;↵

2

            XIntervalDataItem item2 = null;↵

3

            try {↵

3

            try {↵

4

                v2 = (VectorDataItem) v1.clone();↵

4

                item2 = (XIntervalDataItem) item1.clone();↵

5

            }↵

5

            }↵

6

            catch (CloneNotSupportedException e) {↵

6

            catch (CloneNotSupportedException e) {↵

7

                e.printStackTrace();↵

7

                e.printStackTrace();↵

8

            }↵

8

            }↵

9

            assertTrue(v1 != v2);↵

9

            assertTrue(item1 != item2);↵

10

            assertTrue(v1.getClass() == v2.getClass());↵

10

            assertTrue(item1.getClass() == item2.getClass());↵

11

            assertTrue(v1.equals(v2));

11

            assertTrue(item1.equals(item2));

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

1. {Non-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.7
   Clone type | Type 2

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

   1

       VectorDataItem v1 = new VectorDataItem(1.0, 2.0, 3.0, 4.0);

   1 | VectorDataItem v1 = new VectorDataItem(1.0, 2.0, 3.0, 4.0);
   1 | XIntervalDataItem item1 = new XIntervalDataItem(1.0, 2.0, 3.0, 4.0);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH
   v1 | item1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH

   1

       XIntervalDataItem item1 = new XIntervalDataItem(1.0, 2.0, 3.0, 4.0);

   2

       VectorDataItem v2 = null;

   2 | VectorDataItem v2 = null;
   2 | XIntervalDataItem item2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH
   v2 | item2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH

   2

       XIntervalDataItem item2 = null;

   3

       try

   3

       try

   4

       v2 = (VectorDataItem)v1.clone();

   4 | v2 = (VectorDataItem)v1.clone();
   4 | item2 = (XIntervalDataItem)item1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   v2 | item2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH
   v1 | item1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (VectorDataItem)v1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (XIntervalDataItem)item1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       item2 = (XIntervalDataItem)item1.clone();

   5

       assertTrue(v1 != v2);

   5 | assertTrue(v1 != v2);
   5 | assertTrue(item1 != item2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   v1 | item1 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH
   v2 | item2 | VARIABLE_NAME_MISMATCH
   org.jfree.data.xy.VectorDataItem | org.jfree.data.xy.XIntervalDataItem | SUBCLASS_TYPE_MISMATCH

   5

       assertTrue(item1 != item2);

   6

       assertTrue(v1.getClass() == v2.getClass());

   6 | assertTrue(v1.getClass() == v2.getClass());
   7 | assertTrue(item1.equals(item2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   v1.getClass() == v2.getClass() | item1.equals(item2) | TYPE_COMPATIBLE_REPLACEMENT

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

   7

       assertTrue(item1.equals(item2));

   7

       assertTrue(v1.equals(v2));

   7 | assertTrue(v1.equals(v2));
   6 | assertTrue(item1.getClass() == item2.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   v1.equals(v2) | item1.getClass() == item2.getClass() | TYPE_COMPATIBLE_REPLACEMENT

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

   6

       assertTrue(item1.getClass() == item2.getClass());

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Expression (VectorDataItem)v1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (XIntervalDataItem)item1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression v1.getClass() == v2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression item1.equals(item2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression v1.equals(v2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression item1.getClass() == item2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted