OHLCSeriesCollection c1 = new OHLCSeriesCollection(); OHLCSeries s1 = new OHLCSeries("Series"); s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3); c1.addSeries(s1); OHLCSeriesCollection 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 = (OHLCSeriesCollection) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(c1, c2);
DefaultTableXYDataset d1 = new DefaultTableXYDataset(); XYSeries s1 = new XYSeries("Series 1", true, false); s1.add(1.0, 1.1); s1.add(2.0, 2.2); d1.addSeries(s1); DefaultTableXYDataset d2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(d1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); d2 = (DefaultTableXYDataset) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(d1, d2);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/ohlc/junit/OHLCSeriesCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/DefaultTableXYDatasetTests.java
Method name: void testSerialization() Method name: void testSerialization()
Number of AST nodes: 14 Number of AST nodes: 15
1
OHLCSeriesCollection c1 = new OHLCSeriesCollection();
1
DefaultTableXYDataset d1 = new DefaultTableXYDataset();
2
        OHLCSeries s1 = new OHLCSeries("Series");
2
        XYSeries s1 = new XYSeries("Series 1", true, false);
3
        s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3
3
        s1.add(1.0, 1.1);
4
);
4
        s1.add(2.0, 2.2);
5
        c1.addSeries(s1);
5
        d1.addSeries(s1);
6
        OHLCSeriesCollection c2 = null;
6
        DefaultTableXYDataset d2 = null;
7
        
8
        try {
7
        try {
9
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
8
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
10
            ObjectOutput out = new ObjectOutputStream(buffer);
9
            ObjectOutput out = new ObjectOutputStream(buffer);
11
            out.writeObject(c1);
10
            out.writeObject(d1);
12
            out.close();
11
            out.close();
13
            ObjectInput in = new ObjectInputStream(
12
            ObjectInput in = new ObjectInputStream(
14
                    new ByteArrayInputStream(buffer.toByteArray()));
13
                    new ByteArrayInputStream(buffer.toByteArray()));
15
            c2 = (OHLCSeriesCollection) in.readObject();
14
            d2 = (DefaultTableXYDataset) in.readObject();
16
            in.close();
15
            in.close();
17
        }
16
        }
18
        catch (Exception e) {
17
        catch (Exception e) {
19
            e.printStackTrace();
18
            e.printStackTrace();
20
        }
19
        }
21
        assertEquals(c1, c2);
20
        assertEquals(d1, d2);
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 fragment1
    Time elapsed for statement mapping (ms)83.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    1
    OHLCSeriesCollection c1 = new OHLCSeriesCollection();
    1
    DefaultTableXYDataset d1 = new DefaultTableXYDataset();
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    c1d1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new OHLCSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DefaultTableXYDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    DefaultTableXYDataset d1 = new DefaultTableXYDataset();
    2
    OHLCSeries s1 = new OHLCSeries("Series");
    2
    OHLCSeries s1 = new OHLCSeries("Series");
    2
    XYSeries s1 = new XYSeries("Series 1", true, false);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    new OHLCSeries("Series")new XYSeries("Series 1",true,false)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new XYSeries("Series 1",true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYSeries("Series 1",true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    XYSeries s1 = new XYSeries("Series 1", true, false);
    3
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    3
    s1.add(new Year(2006), 1.0, 1.1, 1.2, 1.3);
    3
    s1.add(1.0, 1.1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    s1.add(new Year(2006),1.0,1.1,1.2,1.3)s1.add(1.0,1.1)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.general.Series does not declare member(s) public void add(org.jfree.data.time.RegularTimePeriod, double, double, double, double) , public void add(double, double)
    Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.add(1.0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized
    Expression s1.add(1.0,1.1) is a void method call, and thus it cannot be parameterized
    3
    s1.add(1.0, 1.1);
                                          
    4
    s1.add(2.0, 2.2);
    Preondition Violations
    Unmatched statement s1.add(2.0,2.2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    s1.add(2.0, 2.2);
    4
    c1.addSeries(s1);
    4
    c1.addSeries(s1);
    5
    d1.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    c1d1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_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.time.ohlc.OHLCSeries)
    Expression c1 cannot be unified with expression d1 , because common superclass org.jfree.data.xy.AbstractXYDataset does not declare member(s) public void addSeries(org.jfree.data.time.ohlc.OHLCSeries) , public void addSeries(org.jfree.data.xy.XYSeries)
    5
    d1.addSeries(s1);
    5
    OHLCSeriesCollection c2 = null;
    5
    OHLCSeriesCollection c2 = null;
    6
    DefaultTableXYDataset d2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    c2d2VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    6
    DefaultTableXYDataset d2 = null;
    6
    try
    7
    try
    7
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    8
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    8
    ObjectOutput out = new ObjectOutputStream(buffer);
    9
    ObjectOutput out = new ObjectOutputStream(buffer);
    9
    out.writeObject(c1);
    9
    out.writeObject(c1);
    10
    out.writeObject(d1);
    Differences
    Expression1Expression2Difference
    c1d1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    10
    out.writeObject(d1);
    10
    out.close();
    11
    out.close();
    11
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    12
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    12
    c2 = (OHLCSeriesCollection)in.readObject();
    12
    c2 = (OHLCSeriesCollection)in.readObject();
    13
    d2 = (DefaultTableXYDataset)in.readObject();
    Differences
    Expression1Expression2Difference
    c2d2VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (OHLCSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (DefaultTableXYDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13
    d2 = (DefaultTableXYDataset)in.readObject();
    13
    in.close();
    14
    in.close();
    14
    assertEquals(c1, c2);
    14
    assertEquals(c1, c2);
    15
    assertEquals(d1, d2);
    Differences
    Expression1Expression2Difference
    c1d1VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    c2d2VARIABLE_NAME_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesCollectionorg.jfree.data.xy.DefaultTableXYDatasetSUBCLASS_TYPE_MISMATCH
    15
    assertEquals(d1, d2);
    Precondition Violations (14)
    Row Violation
    1Expression new OHLCSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DefaultTableXYDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new XYSeries("Series 1",true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new XYSeries("Series 1",true,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression s1 cannot be unified with expression s1 , because common superclass org.jfree.data.general.Series does not declare member(s) public void add(org.jfree.data.time.RegularTimePeriod, double, double, double, double) , public void add(double, double)
    6Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression s1.add(1.0,1.1) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression s1.add(new Year(2006),1.0,1.1,1.2,1.3) is a void method call, and thus it cannot be parameterized
    9Expression s1.add(1.0,1.1) is a void method call, and thus it cannot be parameterized
    10Unmatched statement s1.add(2.0,2.2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    11Expression 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.time.ohlc.OHLCSeries)
    12Expression c1 cannot be unified with expression d1 , because common superclass org.jfree.data.xy.AbstractXYDataset does not declare member(s) public void addSeries(org.jfree.data.time.ohlc.OHLCSeries) , public void addSeries(org.jfree.data.xy.XYSeries)
    13Expression (OHLCSeriesCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression (DefaultTableXYDataset)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted