1411-1-2

if (mappedAxis == null) { if (axisIndex.equals(ZERO)) { result.add(this.datasets.get(i)); } } else { if (mappedAxis.equals(axisIndex)) { result.add(this.datasets.get(i)); } }
if (mappedAxis == null) { if (axisIndex.equals(ZERO)) { result.add(this.datasets.get(i)); } } else { if (mappedAxis.equals(axisIndex)) { result.add(this.datasets.get(i)); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/XYPlot.java
Method name: `List getDatasetsMappedToDomainAxis(Integer)` |  | Method name: `List getDatasetsMappedToRangeAxis(Integer)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    if (mappedAxis == null) {↵

1

    if (mappedAxis == null) {↵

2

                    if (axisIndex.equals(ZERO)) {↵

2

                    if (axisIndex.equals(ZERO)) {↵

3

                        result.add(this.datasets.get(i));↵

3

                        result.add(this.datasets.get(i));↵

4

                    }↵

4

                    }↵

5

                }↵

5

                }↵

6

                else {↵

6

                else {↵

7

                    if (mappedAxis.equals(axisIndex)) {↵

7

                    if (mappedAxis.equals(axisIndex)) {↵

8

                        result.add(this.datasets.get(i));↵

8

                        result.add(this.datasets.get(i));↵

9

                    }↵

9

                    }↵

10

                }

10

                }

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.6
Clones location | Clones are declared in the same class
Number of node comparisons | 15

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) | 8.3
   Clone type | Type 1

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

   6

       if (mappedAxis == null)

   6

       if (mappedAxis == null)

   7

       if (axisIndex.equals(ZERO))

   7

       if (axisIndex.equals(ZERO))

   8

       result.add(this.datasets.get(i));

   8

       result.add(this.datasets.get(i));

       else

       else

   9

       if (mappedAxis.equals(axisIndex))

   9

       if (mappedAxis.equals(axisIndex))

   10

       result.add(this.datasets.get(i));

   10

       result.add(this.datasets.get(i));

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