MatrixSeries s1 = new MatrixSeries("Series", 2, 3); s1.update(0, 0, 1.1); MatrixSeriesCollection c1 = new MatrixSeriesCollection(); c1.addSeries(s1); MatrixSeriesCollection c2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(c1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); c2 = (MatrixSeriesCollection) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(c1, c2);
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 { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(c1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); c2 = (VectorSeriesCollection) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(c1, c2);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/MatrixSeriesCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/VectorSeriesCollectionTests.java
Method name: void testSerialization() Method name: void testSerialization()
Number of AST nodes: 14 Number of AST nodes: 14
1
MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
1
VectorSeries s1 = new VectorSeries("Series");
2
        s1.update(0, 0, 1.1);
2
        s1.add(1.0, 1.1, 1.2, 1.3);
3
        MatrixSeriesCollection c1 = new MatrixSeriesCollection();
3
        VectorSeriesCollection c1 = new VectorSeriesCollection();
4
        c1.addSeries(s1);
4
        c1.addSeries(s1);
5
        MatrixSeriesCollection c2 = null;
5
        VectorSeriesCollection c2 = null;
6
        try {
6
        try {
7
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
7
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
8
            ObjectOutput out = new ObjectOutputStream(buffer);
8
            ObjectOutput out = new ObjectOutputStream(buffer);
9
            out.writeObject(c1);
9
            out.writeObject(c1);
10
            out.close();
10
            out.close();
11
            ObjectInput in = new ObjectInputStream(
11
            ObjectInput in = new ObjectInputStream(
12
                    new ByteArrayInputStream(buffer.toByteArray()));
12
                    new ByteArrayInputStream(buffer.toByteArray()));
13
            c2 = (MatrixSeriesCollection) in.readObject();
13
            c2 = (VectorSeriesCollection) in.readObject();
14
            in.close();
14
            in.close();
15
        }
15
        }
16
        catch (Exception e) {
16
        catch (Exception e) {
17
            e.printStackTrace();
17
            e.printStackTrace();
18
        }
18
        }
19
        assertEquals(c1, c2);
19
        assertEquals(c1, 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 comparisons80
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)62.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    1
    MatrixSeries s1 = new MatrixSeries("Series", 2, 3);
    1
    VectorSeries s1 = new VectorSeries("Series");
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesorg.jfree.data.xy.VectorSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesorg.jfree.data.xy.VectorSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesorg.jfree.data.xy.VectorSeriesSUBCLASS_TYPE_MISMATCH
    new MatrixSeries("Series",2,3)new VectorSeries("Series")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new MatrixSeries("Series",2,3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new MatrixSeries("Series",2,3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    VectorSeries s1 = new VectorSeries("Series");
    2
    s1.update(0, 0, 1.1);
    2
    s1.update(0, 0, 1.1);
    2
    s1.add(1.0, 1.1, 1.2, 1.3);
    Differences
    Expression1Expression2Difference
    updateaddMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.data.xy.MatrixSeriesorg.jfree.data.xy.VectorSeriesSUBCLASS_TYPE_MISMATCH
    s1.update(0,0,1.1)s1.add(1.0,1.1,1.2,1.3)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression s1.update(0,0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.add(1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.update(0,0,1.1) is a void method call, and thus it cannot be parameterized
    Expression s1.add(1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized
    Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.general.Series does not declare member(s) public void update(int, int, double) , public void add(double, double, double, double)
    Expression s1.update(0,0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.add(1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.update(0,0,1.1) is a void method call, and thus it cannot be parameterized
    Expression s1.add(1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized
    2
    s1.add(1.0, 1.1, 1.2, 1.3);
    3
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    3
    MatrixSeriesCollection c1 = new MatrixSeriesCollection();
    3
    VectorSeriesCollection c1 = new VectorSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new MatrixSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new VectorSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    VectorSeriesCollection c1 = new VectorSeriesCollection();
    4
    c1.addSeries(s1);
    4
    c1.addSeries(s1);
    4
    c1.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesorg.jfree.data.xy.VectorSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.general.Series cannot be passed as an argument to public void addSeries(org.jfree.data.xy.MatrixSeries)
    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.MatrixSeries) , public void addSeries(org.jfree.data.xy.VectorSeries)
    4
    c1.addSeries(s1);
    5
    MatrixSeriesCollection c2 = null;
    5
    MatrixSeriesCollection c2 = null;
    5
    VectorSeriesCollection c2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    5
    VectorSeriesCollection c2 = null;
    6
    try
    6
    try
    7
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    7
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    8
    ObjectOutput out = new ObjectOutputStream(buffer);
    8
    ObjectOutput out = new ObjectOutputStream(buffer);
    9
    out.writeObject(c1);
    9
    out.writeObject(c1);
    9
    out.writeObject(c1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    9
    out.writeObject(c1);
    10
    out.close();
    10
    out.close();
    11
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    11
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    12
    c2 = (MatrixSeriesCollection)in.readObject();
    12
    c2 = (MatrixSeriesCollection)in.readObject();
    12
    c2 = (VectorSeriesCollection)in.readObject();
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (MatrixSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (VectorSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    c2 = (VectorSeriesCollection)in.readObject();
    13
    in.close();
    13
    in.close();
    14
    assertEquals(c1, c2);
    14
    assertEquals(c1, c2);
    14
    assertEquals(c1, c2);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.MatrixSeriesCollectionorg.jfree.data.xy.VectorSeriesCollectionSUBCLASS_TYPE_MISMATCH
    14
    assertEquals(c1, c2);
    Precondition Violations (17)
    Row Violation
    1Expression new MatrixSeries("Series",2,3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new MatrixSeries("Series",2,3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s1.update(0,0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression s1.add(1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression s1.update(0,0,1.1) is a void method call, and thus it cannot be parameterized
    6Expression s1.add(1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized
    7Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.general.Series does not declare member(s) public void update(int, int, double) , public void add(double, double, double, double)
    8Expression s1.update(0,0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression s1.add(1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression s1.update(0,0,1.1) is a void method call, and thus it cannot be parameterized
    11Expression s1.add(1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized
    12Expression new MatrixSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression new VectorSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.general.Series cannot be passed as an argument to public void addSeries(org.jfree.data.xy.MatrixSeries)
    15Expression 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.MatrixSeries) , public void addSeries(org.jfree.data.xy.VectorSeries)
    16Expression (MatrixSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression (VectorSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted