347-3-4

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);
YIntervalSeriesCollection c = new YIntervalSeriesCollection(); YIntervalSeries s1 = new YIntervalSeries("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/XYSeriesCollectionTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/data/xy/junit/YIntervalSeriesCollectionTests.java
Method name: `void testRemoveSeries()` |  | Method name: `void testRemoveSeries()`
Number of AST nodes: 14 |  | Number of AST nodes: 14

1

    XYSeriesCollection c = new XYSeriesCollection();↵

1

    YIntervalSeriesCollection c = new YIntervalSeriesCollection();↵

2

            XYSeries s1 = new XYSeries("s1");↵

2

            YIntervalSeries s1 = new YIntervalSeries("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);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 47

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 14
   Number of unmapped statements in the first code fragment | 0
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 9.4
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       XYSeriesCollection c = new XYSeriesCollection();

   1

       YIntervalSeriesCollection c = new YIntervalSeriesCollection();

   2

       XYSeries s1 = new XYSeries("s1");

   2 | XYSeries s1 = new XYSeries("s1");
   2 | YIntervalSeries s1 = new YIntervalSeries("s1");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.XYSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.XYSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.xy.XYSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   2

       YIntervalSeries s1 = new YIntervalSeries("s1");

   3

       c.addSeries(s1);

   3 | c.addSeries(s1);
   3 | c.addSeries(s1);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.XYSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   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);
   6 | c.addSeries(s1);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.XYSeries | org.jfree.data.xy.YIntervalSeries | SUBCLASS_TYPE_MISMATCH

   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

       assertTrue(pass);

   10

       assertTrue(pass);

   11

       pass = false;

   11

       pass = false;

   12

       try

   12

       try

   13

       c.removeSeries(1);

   13

       c.removeSeries(1);

   14

       assertTrue(pass);

   14

       assertTrue(pass);

   Precondition Violations (0)
   Row | Violation
   --- | ---