XIntervalSeriesCollection c = new XIntervalSeriesCollection(); XIntervalSeries s1 = new XIntervalSeries("s1"); c.addSeries(s1); c.removeSeries(0); assertEquals(0, c.getSeriesCount()); c.addSeries(s1); boolean pass = false; try { c.removeSeries(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { c.removeSeries(1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass);
XYSeriesCollection c = new XYSeriesCollection(); XYSeries s1 = new XYSeries("s1"); c.addSeries(s1); c.removeSeries(0); assertEquals(0, c.getSeriesCount()); c.addSeries(s1); boolean pass = false; try { c.removeSeries(-1); } catch (IllegalArgumentException e) { pass = true; } assertTrue(pass); pass = false; try { c.removeSeries(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/xy/junit/XIntervalSeriesCollectionTests.java File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/XYSeriesCollectionTests.java
Method name: void testRemoveSeries() Method name: void testRemoveSeries()
Number of AST nodes: 14 Number of AST nodes: 14
1
XIntervalSeriesCollection c = new XIntervalSeriesCollection();
1
XYSeriesCollection c = new XYSeriesCollection();
2
        XIntervalSeries s1 = new XIntervalSeries("s1");
2
        XYSeries s1 = new XYSeries("s1");
3
        c.addSeries(s1);
3
        c.addSeries(s1);
4
        c.removeSeries(0);
4
        c.removeSeries(0);
5
        assertEquals(0, c.getSeriesCount());
5
        assertEquals(0, c.getSeriesCount());
6
        c.addSeries(s1);
6
        c.addSeries(s1);
7
        boolean pass = false;
7
        boolean pass = false;
8
        try {
8
        try {
9
            c.removeSeries(-1);
9
            c.removeSeries(-1);
10
        }
10
        }
11
        catch (IllegalArgumentException e) {
11
        catch (IllegalArgumentException e) {
12
            pass = true;
12
            pass = true;
13
        }
13
        }
14
        assertTrue(pass);
14
        assertTrue(pass);
15
        pass = false;
15
        pass = false;
16
        try {
16
        try {
17
            c.removeSeries(1);
17
            c.removeSeries(1);
18
        }
18
        }
19
        catch (IllegalArgumentException e) {
19
        catch (IllegalArgumentException e) {
20
            pass = true;
20
            pass = true;
21
        }
21
        }
22
        assertTrue(pass);
22
        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 comparisons43
  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)63.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    1
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    1
    XYSeriesCollection c = new XYSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new XIntervalSeriesCollection() 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
    XIntervalSeries s1 = new XIntervalSeries("s1");
    2
    XIntervalSeries s1 = new XIntervalSeries("s1");
    2
    XYSeries s1 = new XYSeries("s1");
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    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
    c.addSeries(s1);
    3
    c.addSeries(s1);
    3
    c.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.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.xy.XIntervalSeries)
    Expression c 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.xy.XIntervalSeries) , public void addSeries(org.jfree.data.xy.XYSeries)
    3
    c.addSeries(s1);
    4
    c.removeSeries(0);
    4
    c.removeSeries(0);
    4
    c.removeSeries(0);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    4
    c.removeSeries(0);
    5
    assertEquals(0, c.getSeriesCount());
    5
    assertEquals(0, c.getSeriesCount());
    5
    assertEquals(0, c.getSeriesCount());
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    5
    assertEquals(0, c.getSeriesCount());
    6
    c.addSeries(s1);
    6
    c.addSeries(s1);
    6
    c.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.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.xy.XIntervalSeries)
    Expression c 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.xy.XIntervalSeries) , public void addSeries(org.jfree.data.xy.XYSeries)
    6
    c.addSeries(s1);
    7
    boolean pass = false;
    7
    boolean pass = false;
    8
    try
    8
    try
    9
    c.removeSeries(-1);
    9
    c.removeSeries(-1);
    9
    c.removeSeries(-1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    9
    c.removeSeries(-1);
    10
    assertTrue(pass);
    10
    assertTrue(pass);
    11
    pass = false;
    11
    pass = false;
    12
    try
    12
    try
    13
    c.removeSeries(1);
    13
    c.removeSeries(1);
    13
    c.removeSeries(1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    13
    c.removeSeries(1);
    14
    assertTrue(pass);
    14
    assertTrue(pass);
    Precondition Violations (10)
    Row Violation
    1Expression new XIntervalSeriesCollection() 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 XYSeries("s1") 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.general.Series cannot be passed as an argument to public void addSeries(org.jfree.data.xy.XIntervalSeries)
    5Expression c 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.xy.XIntervalSeries) , public void addSeries(org.jfree.data.xy.XYSeries)
    6Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    7Expression 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.XIntervalSeries)
    8Expression c 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.xy.XIntervalSeries) , public void addSeries(org.jfree.data.xy.XYSeries)
    9Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    10Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)