1067-1-2

Integer m = (Integer) this.datasetToDomainAxisMap.get( datasetIndex); if (m == null) { // a dataset with no mapping is assigned to // axis 0 if (axisIndex == 0) { result.add(dataset); } } else { if (m.intValue() == axisIndex) { result.add(dataset); } }
Integer m = (Integer) this.datasetToRangeAxisMap.get(i); if (m == null) { // a dataset with no mapping is assigned to // axis 0 if (index == 0) { result.add(dataset); } } else { if (m.intValue() == index) { result.add(dataset); } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryPlot.java
Method name: `List datasetsMappedToDomainAxis(int)` |  | Method name: `List datasetsMappedToRangeAxis(int)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    Integer m = (Integer) this.datasetToDomainAxisMap.get(↵

1

    Integer m = (Integer) this.datasetToRangeAxisMap.get(↵

2

                            datasetIndex);↵

2

    i);↵

3

                    if (m == null) {  // a dataset with no mapping is assigned to↵

3

                    if (m == null) {  // a dataset with no mapping is assigned to↵

4

                                      // axis 0↵

4

                                      // axis 0↵

5

                        if (axisIndex == 0) {↵

5

                        if (index == 0) {↵

6

                            result.add(dataset);↵

6

                            result.add(dataset);↵

7

                        }↵

7

                        }↵

8

                    }↵

8

                    }↵

9

                    else {↵

9

                    else {↵

10

                        if (m.intValue() == axisIndex) {↵

10

                        if (m.intValue() == index) {↵

11

                            result.add(dataset);↵

11

                            result.add(dataset);↵

12

                        }↵

12

                        }↵

13

                    }

13

                    }

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

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 6
   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.8
   Clone type | Type 2

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

   5

       Integer m = (Integer)this.datasetToDomainAxisMap.get(datasetIndex);

   5 | Integer m = (Integer)this.datasetToDomainAxisMap.get(datasetIndex);
   5 | Integer m = (Integer)this.datasetToRangeAxisMap.get(i);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   datasetIndex | i | VARIABLE_NAME_MISMATCH
   datasetToDomainAxisMap | datasetToRangeAxisMap | VARIABLE_NAME_MISMATCH

   5

       Integer m = (Integer)this.datasetToRangeAxisMap.get(i);

   6

       if (m == null)

   6

       if (m == null)

   7

       if (axisIndex == 0)

   7 | if (axisIndex == 0)
   7 | if (index == 0)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   axisIndex | index | VARIABLE_NAME_MISMATCH

   7

       if (index == 0)

   8

       result.add(dataset);

   8

       result.add(dataset);

       else

       else

   9

       if (m.intValue() == axisIndex)

   9 | if (m.intValue() == axisIndex)
   9 | if (m.intValue() == index)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   axisIndex | index | VARIABLE_NAME_MISMATCH

   9

       if (m.intValue() == index)

   10

       result.add(dataset);

   10

       result.add(dataset);

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