TimePeriodValuesCollection c1 = new TimePeriodValuesCollection(); TimePeriodValues s1 = new TimePeriodValues("Series 1"); c1.addSeries(s1); assertEquals("Series 1", c1.getSeries(0).getKey()); boolean pass = false; try { c1.getSeries(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { c1.getSeries(1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
XYSeriesCollection c = new XYSeriesCollection(); XYSeries s1 = new XYSeries("s1"); c.addSeries(s1); assertEquals("s1", c.getSeries(0).getKey()); boolean pass = false; try { c.getSeries(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { c.getSeries(1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/data/time/junit/TimePeriodValuesCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYSeriesCollectionTests.java
Method name: void testGetSeries() Method name: void testGetSeries()
Number of AST nodes: 12 Number of AST nodes: 12
1
TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
1
XYSeriesCollection c = new XYSeriesCollection();
2
        TimePeriodValues s1 = new TimePeriodValues("Series 1");
2
        XYSeries s1 = new XYSeries("s1");
3
        c1.addSeries(s1);
3
        c.addSeries(s1);
4
        assertEquals("Series 1", c1.getSeries(0).getKey());
4
        assertEquals("s1", c.getSeries(0).getKey());
5
        
6
        boolean pass = false;
5
        boolean pass = false;
7
        try {
6
        try {
8
            c1.getSeries(-1);
7
            c.getSeries(-1);
9
        }
8
        }
10
        catch (IllegalArgumentException e) {
9
        catch (IllegalArgumentException e) {
11
            pass = true;
10
            pass = true;
12
        }
11
        }
13
        assertTrue(pass);
12
        assertTrue(pass);
14
        
15
        pass = false;
13
        pass = false;
16
        try {
14
        try {
17
            c1.getSeries(1);
15
            c.getSeries(1);
18
        }
16
        }
19
        catch (IllegalArgumentException e) {
17
        catch (IllegalArgumentException e) {
20
            pass = true;
18
            pass = true;
21
        }
19
        }
22
        assertTrue(pass);
20
        assertTrue(pass);
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons31
  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)57.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
    1
    TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
    1
    XYSeriesCollection c = new XYSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    c1cVARIABLE_NAME_MISMATCH
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new TimePeriodValuesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    XYSeriesCollection c = new XYSeriesCollection();
    2
    TimePeriodValues s1 = new TimePeriodValues("Series 1");
    2
    TimePeriodValues s1 = new TimePeriodValues("Series 1");
    2
    XYSeries s1 = new XYSeries("s1");
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.TimePeriodValuesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.TimePeriodValuesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.time.TimePeriodValuesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    "Series 1""s1"LITERAL_VALUE_MISMATCH
    Preondition Violations
    Expression new TimePeriodValues("Series 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYSeries("s1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    XYSeries s1 = new XYSeries("s1");
    3
    c1.addSeries(s1);
    3
    c1.addSeries(s1);
    3
    c.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.time.TimePeriodValuesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    c1cVARIABLE_NAME_MISMATCH
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_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.TimePeriodValues)
    Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void addSeries(org.jfree.data.time.TimePeriodValues) , public void addSeries(org.jfree.data.xy.XYSeries)
    3
    c.addSeries(s1);
    4
    assertEquals("Series 1", c1.getSeries(0).getKey());
    4
    assertEquals("Series 1", c1.getSeries(0).getKey());
    4
    assertEquals("s1", c.getSeries(0).getKey());
    Differences
    Expression1Expression2Difference
    "Series 1""s1"LITERAL_VALUE_MISMATCH
    c1cVARIABLE_NAME_MISMATCH
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public org.jfree.data.time.TimePeriodValues getSeries(int) , public org.jfree.data.xy.XYSeries getSeries(int)
    4
    assertEquals("s1", c.getSeries(0).getKey());
    5
    boolean pass = false;
    5
    boolean pass = false;
    6
    try
    6
    try
    7
    c1.getSeries(-1);
    7
    c1.getSeries(-1);
    7
    c.getSeries(-1);
    Differences
    Expression1Expression2Difference
    c1cVARIABLE_NAME_MISMATCH
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public org.jfree.data.time.TimePeriodValues getSeries(int) , public org.jfree.data.xy.XYSeries getSeries(int)
    7
    c.getSeries(-1);
    8
    assertTrue(pass);
    8
    assertTrue(pass);
    9
    pass = false;
    9
    pass = false;
    10
    try
    10
    try
    11
    c1.getSeries(1);
    11
    c1.getSeries(1);
    11
    c.getSeries(1);
    Differences
    Expression1Expression2Difference
    c1cVARIABLE_NAME_MISMATCH
    org.jfree.data.time.TimePeriodValuesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public org.jfree.data.time.TimePeriodValues getSeries(int) , public org.jfree.data.xy.XYSeries getSeries(int)
    11
    c.getSeries(1);
    12
    assertTrue(pass);
    12
    assertTrue(pass);
    Precondition Violations (9)
    Row Violation
    1Expression new TimePeriodValuesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new XYSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new TimePeriodValues("Series 1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new XYSeries("s1") 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 type org.jfree.data.general.Series cannot be passed as an argument to public void addSeries(org.jfree.data.time.TimePeriodValues)
    6Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void addSeries(org.jfree.data.time.TimePeriodValues) , public void addSeries(org.jfree.data.xy.XYSeries)
    7Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public org.jfree.data.time.TimePeriodValues getSeries(int) , public org.jfree.data.xy.XYSeries getSeries(int)
    8Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public org.jfree.data.time.TimePeriodValues getSeries(int) , public org.jfree.data.xy.XYSeries getSeries(int)
    9Expression c1 cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public org.jfree.data.time.TimePeriodValues getSeries(int) , public org.jfree.data.xy.XYSeries getSeries(int)