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);
XYIntervalSeriesCollection c = new XYIntervalSeriesCollection(); XYIntervalSeries s1 = new XYIntervalSeries("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/XYIntervalSeriesCollectionTests.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
XYIntervalSeriesCollection c = new XYIntervalSeriesCollection();
2
        XIntervalSeries s1 = new XIntervalSeries("s1");
2
        XYIntervalSeries s1 = new XYIntervalSeries("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)57.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    1
    XIntervalSeriesCollection c = new XIntervalSeriesCollection();
    1
    XYIntervalSeriesCollection c = new XYIntervalSeriesCollection();
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new XYIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    XYIntervalSeriesCollection c = new XYIntervalSeriesCollection();
    2
    XIntervalSeries s1 = new XIntervalSeries("s1");
    2
    XIntervalSeries s1 = new XIntervalSeries("s1");
    2
    XYIntervalSeries s1 = new XYIntervalSeries("s1");
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    2
    XYIntervalSeries s1 = new XYIntervalSeries("s1");
    3
    c.addSeries(s1);
    3
    c.addSeries(s1);
    3
    c.addSeries(s1);
    Differences
    Expression1Expression2Difference
    org.jfree.data.xy.XIntervalSeriesorg.jfree.data.xy.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.ComparableObjectSeries 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.XYIntervalSeries)
    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.XYIntervalSeriesCollectionSUBCLASS_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.XYIntervalSeriesCollectionSUBCLASS_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.XYIntervalSeriesSUBCLASS_TYPE_MISMATCH
    org.jfree.data.xy.XIntervalSeriesCollectionorg.jfree.data.xy.XYIntervalSeriesCollectionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.ComparableObjectSeries 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.XYIntervalSeries)
    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.XYIntervalSeriesCollectionSUBCLASS_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.XYIntervalSeriesCollectionSUBCLASS_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 (9)
    Row Violation
    1Expression new XIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new XYIntervalSeriesCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.ComparableObjectSeries cannot be passed as an argument to public void addSeries(org.jfree.data.xy.XIntervalSeries)
    4Expression 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.XYIntervalSeries)
    5Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    6Expression s1 cannot be unified with expression s1 , because common superclass type org.jfree.data.ComparableObjectSeries cannot be passed as an argument to public void addSeries(org.jfree.data.xy.XIntervalSeries)
    7Expression 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.XYIntervalSeries)
    8Expression c cannot be unified with expression c , because common superclass org.jfree.data.xy.AbstractIntervalXYDataset does not declare member(s) public void removeSeries(int)
    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)