VectorSeries s1 = new VectorSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); VectorSeriesCollection c1 = new VectorSeriesCollection(); c1.addSeries(s1); VectorSeriesCollection c2 = null; try { c2 = (VectorSeriesCollection) c1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(c1 != c2); assertTrue(c1.getClass() == c2.getClass()); assertTrue(c1.equals(c2)); // check independence s1.setDescription("XYZ"); assertFalse(c1.equals(c2));
XIntervalSeriesCollection c1 = new XIntervalSeriesCollection(); XIntervalSeries s1 = new XIntervalSeries("Series"); s1.add(1.0, 1.1, 1.2, 1.3); c1.addSeries(s1); XIntervalSeriesCollection c2 = null; try { c2 = (XIntervalSeriesCollection) c1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(c1 != c2); assertTrue(c1.getClass() == c2.getClass()); assertTrue(c1.equals(c2)); // check independence s1.setDescription("XYZ"); assertFalse(c1.equals(c2));
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/VectorSeriesCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XIntervalSeriesCollectionTests.java
Method name: void testCloning() Method name: void testCloning()
Number of AST nodes: 12 Number of AST nodes: 12
1
Vector
1
XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
2
Series s1 = new VectorSeries("Series");
2
        XIntervalSeries s1 = new XIntervalSeries("Series");
3
        s1.add(1.0, 1.1, 1.2, 1.3);
3
        s1.add(1.0, 1.1, 1.2, 1.3);
4
        VectorSeriesCollection c1 = new VectorSeriesCollection();
5
        c1.addSeries(s1);
4
        c1.addSeries(s1);
6
        VectorSeriesCollection c2 = null;
5
        XIntervalSeriesCollection c2 = null;
7
        try {
6
        try {
8
            c2 = (VectorSeriesCollection) c1.clone();
7
            c2 = (XIntervalSeriesCollection) c1.clone();
9
        }
8
        }
10
        catch (CloneNotSupportedException e) {
9
        catch (CloneNotSupportedException e) {
11
            e.printStackTrace();
10
            e.printStackTrace();
12
        }
11
        }
13
        assertTrue(c1 != c2);
12
        assertTrue(c1 != c2);
14
        assertTrue(c1.getClass() == c2.getClass());
13
        assertTrue(c1.getClass() == c2.getClass());
15
        assertTrue(c1.equals(c2));
14
        assertTrue(c1.equals(c2));
16
        // check independence
15
        // check independence
17
        s1.setDescription("XYZ");
16
        s1.setDescription("XYZ");
18
        assertFalse(c1.equals(c2));
17
        assertFalse(c1.equals(c2));
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes having the same super class
Number of node comparisons46
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)50.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    VectorSeries s1 = new VectorSeries("Series");
    1
    VectorSeries s1 = new VectorSeries("Series");
    2
    XIntervalSeries s1 = new XIntervalSeries("Series");
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesorg.jfree.data.xy.XIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesorg.jfree.data.xy.XIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesorg.jfree.data.xy.XIntervalSeriesSUBCLASS_TYPE_MISMATCH
    2
    XIntervalSeries s1 = new XIntervalSeries("Series");
    2
    s1.add(1.0, 1.1, 1.2, 1.3);
    2
    s1.add(1.0, 1.1, 1.2, 1.3);
    3
    s1.add(1.0, 1.1, 1.2, 1.3);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesorg.jfree.data.xy.XIntervalSeriesSUBCLASS_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)
    3
    s1.add(1.0, 1.1, 1.2, 1.3);
    3
    VectorSeriesCollection c1 = new VectorSeriesCollection();
    3
    VectorSeriesCollection c1 = new VectorSeriesCollection();
    1
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new VectorSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    XIntervalSeriesCollection c1 = new XIntervalSeriesCollection();
    4
    c1.addSeries(s1);
    4
    c1.addSeries(s1);
    4
    c1.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesorg.jfree.data.xy.XIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.ComparableObjectSeries cannot be passed as an argument to public void addSeries(org.jfree.data.xy.VectorSeries)
    Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.data.xy.AbstractXYDataset does not declare member(s) public void addSeries(org.jfree.data.xy.VectorSeries) , public void addSeries(org.jfree.data.xy.XIntervalSeries)
    4
    c1.addSeries(s1);
    5
    VectorSeriesCollection c2 = null;
    5
    VectorSeriesCollection c2 = null;
    5
    XIntervalSeriesCollection c2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    5
    XIntervalSeriesCollection c2 = null;
    6
    try
    6
    try
    7
    c2 = (VectorSeriesCollection)c1.clone();
    7
    c2 = (VectorSeriesCollection)c1.clone();
    7
    c2 = (XIntervalSeriesCollection)c1.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (VectorSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (XIntervalSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    c2 = (XIntervalSeriesCollection)c1.clone();
    8
    assertTrue(c1 != c2);
    8
    assertTrue(c1 != c2);
    8
    assertTrue(c1 != c2);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    8
    assertTrue(c1 != c2);
    9
    assertTrue(c1.getClass() == c2.getClass());
    9
    assertTrue(c1.getClass() == c2.getClass());
    9
    assertTrue(c1.getClass() == c2.getClass());
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    9
    assertTrue(c1.getClass() == c2.getClass());
    10
    assertTrue(c1.equals(c2));
    10
    assertTrue(c1.equals(c2));
    10
    assertTrue(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    10
    assertTrue(c1.equals(c2));
    11
    s1.setDescription("XYZ");
    11
    s1.setDescription("XYZ");
    11
    s1.setDescription("XYZ");
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesorg.jfree.data.xy.XIntervalSeriesSUBCLASS_TYPE_MISMATCH
    11
    s1.setDescription("XYZ");
    12
    assertFalse(c1.equals(c2));
    12
    assertFalse(c1.equals(c2));
    12
    assertFalse(c1.equals(c2));
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.VectorSeriesCollectionorg.jfree.data.xy.XIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    12
    assertFalse(c1.equals(c2));
    Precondition Violations (7)
    Row Violation
    1Expression 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)
    2Expression new VectorSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.ComparableObjectSeries cannot be passed as an argument to public void addSeries(org.jfree.data.xy.VectorSeries)
    5Expression c1 cannot be unified with expression c1 , because common superclass org.jfree.data.xy.AbstractXYDataset does not declare member(s) public void addSeries(org.jfree.data.xy.VectorSeries) , public void addSeries(org.jfree.data.xy.XIntervalSeries)
    6Expression (VectorSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (XIntervalSeriesCollection)c1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted