1558-2-3

if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { // replace an existing series this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); }
if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(data); } else { // replace an existing series this.seriesList.remove(seriesIndex); this.seriesList.add(seriesIndex, data); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/xy/DefaultXYDataset.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/xy/DefaultXYZDataset.java
Method name: `void addSeries(Comparable, double[][])` |  | Method name: `void addSeries(Comparable, double[][])`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    if (seriesIndex == -1) {  // add a new series↵

1

    if (seriesIndex == -1) {  // add a new series↵

2

                this.seriesKeys.add(seriesKey);↵

2

                this.seriesKeys.add(seriesKey);↵

3

                this.seriesList.add(data);↵

3

                this.seriesList.add(data);↵

4

            }↵

4

            }↵

5

            else {  // replace an existing series↵

5

            else {  // replace an existing series↵

6

                this.seriesList.remove(seriesIndex);↵

6

                this.seriesList.remove(seriesIndex);↵

7

                this.seriesList.add(seriesIndex, data);↵

7

                this.seriesList.add(seriesIndex, data);↵

8

            }

8

            }

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.1
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 25

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 5
   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) | 1.8
   Clone type | Type 1

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

   10

       if (seriesIndex == -1)

   10

       if (seriesIndex == -1)

   11

       this.seriesKeys.add(seriesKey);

   11

       this.seriesKeys.add(seriesKey);

   12

       this.seriesList.add(data);

   12

       this.seriesList.add(data);

       else

       else

   13

       this.seriesList.remove(seriesIndex);

   13

       this.seriesList.remove(seriesIndex);

   14

       this.seriesList.add(seriesIndex, data);

   14

       this.seriesList.add(seriesIndex, data);

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