OHLCSeries s1 = new OHLCSeries("s1"); s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0); OHLCSeries s2 = null; try { s2 = (OHLCSeries) s1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(s1 != s2); assertTrue(s1.getClass() == s2.getClass()); assertTrue(s1.equals(s2));
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/time/ohlc/junit/OHLCSeriesTests.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: 8 Number of AST nodes: 8
1
OHLCSeries s1 = new OHLCSeries("s1");
1
XYIntervalSeries s1 = new XYIntervalSeries("s1");
2
        s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
2
        s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01);
3
        OHLCSeries s2 = null;
3
        XYIntervalSeries s2 = null;
4
        try {
4
        try {
5
            s2 = (OHLCSeries) s1.clone();
5
            s2 = (XYIntervalSeries) s1.clone();
6
        }
6
        }
7
        catch (CloneNotSupportedException e) {
7
        catch (CloneNotSupportedException e) {
8
            e.printStackTrace();
8
            e.printStackTrace();
9
        }
9
        }
10
        assertTrue(s1 != s2);
10
        assertTrue(s1 != s2);
11
        assertTrue(s1.getClass() == s2.getClass());
11
        assertTrue(s1.getClass() == s2.getClass());
12
        assertTrue(s1.equals(s2));
12
        assertTrue(s1.equals(s2));
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 comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)44.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    OHLCSeries s1 = new OHLCSeries("s1");
    1
    OHLCSeries s1 = new OHLCSeries("s1");
    1
    XYIntervalSeries s1 = new XYIntervalSeries("s1");
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    1
    XYIntervalSeries s1 = new XYIntervalSeries("s1");
    2
    s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
    2
    s1.add(new Year(2006), 2.0, 4.0, 1.0, 3.0);
    2
    s1.add(1.0, 0.5, 1.5, 2.0, 1.9, 2.01);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    s1.add(new Year(2006),2.0,4.0,1.0,3.0)s1.add(1.0,0.5,1.5,2.0,1.9,2.01)ARGUMENT_NUMBER_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(org.jfree.data.time.RegularTimePeriod, double, double, double, double) , public void add(double, double, double, double, double, double)
    Expression s1.add(new Year(2006),2.0,4.0,1.0,3.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 s1.add(new Year(2006),2.0,4.0,1.0,3.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
    OHLCSeries s2 = null;
    3
    OHLCSeries s2 = null;
    3
    XYIntervalSeries s2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    3
    XYIntervalSeries s2 = null;
    4
    try
    4
    try
    5
    s2 = (OHLCSeries)s1.clone();
    5
    s2 = (OHLCSeries)s1.clone();
    5
    s2 = (XYIntervalSeries)s1.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (OHLCSeries)s1.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();
    6
    assertTrue(s1 != s2);
    6
    assertTrue(s1 != s2);
    6
    assertTrue(s1 != s2);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    6
    assertTrue(s1 != s2);
    7
    assertTrue(s1.getClass() == s2.getClass());
    7
    assertTrue(s1.getClass() == s2.getClass());
    7
    assertTrue(s1.getClass() == s2.getClass());
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    7
    assertTrue(s1.getClass() == s2.getClass());
    8
    assertTrue(s1.equals(s2));
    8
    assertTrue(s1.equals(s2));
    8
    assertTrue(s1.equals(s2));
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.ohlc.OHLCSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    8
    assertTrue(s1.equals(s2));
    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(org.jfree.data.time.RegularTimePeriod, double, double, double, double) , public void add(double, double, double, double, double, double)
    2Expression s1.add(new Year(2006),2.0,4.0,1.0,3.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression 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
    4Expression s1.add(new Year(2006),2.0,4.0,1.0,3.0) is a void method call, and thus it cannot be parameterized
    5Expression 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
    6Expression (OHLCSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression (XYIntervalSeries)s1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted