110-1-3

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);

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 | 33

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 12
   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) | 2.4
   Clone type | Type 2

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

   1

       TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();

   1 | TimePeriodValuesCollection c1 = new TimePeriodValuesCollection();
   1 | XYSeriesCollection c = new XYSeriesCollection();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH
   c1 | c | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.TimePeriodValues | org.jfree.data.xy.XYSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.TimePeriodValues | org.jfree.data.xy.XYSeries | SUBCLASS_TYPE_MISMATCH
   org.jfree.data.time.TimePeriodValues | org.jfree.data.xy.XYSeries | SUBCLASS_TYPE_MISMATCH
   "Series 1" | "s1" | LITERAL_VALUE_MISMATCH

   2

       XYSeries s1 = new XYSeries("s1");

   3

       c1.addSeries(s1);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.time.TimePeriodValues | org.jfree.data.xy.XYSeries | SUBCLASS_TYPE_MISMATCH
   c1 | c | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "Series 1" | "s1" | LITERAL_VALUE_MISMATCH
   c1 | c | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   c1 | c | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH

   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
   Expression1 | Expression2 | Difference
   --- | --- | ---
   c1 | c | VARIABLE_NAME_MISMATCH
   org.jfree.data.time.TimePeriodValuesCollection | org.jfree.data.xy.XYSeriesCollection | SUBCLASS_TYPE_MISMATCH

   11

       c.getSeries(1);

   12

       assertTrue(pass);

   12

       assertTrue(pass);

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