1541-1-2

while (iterator.hasNext()) { Object obj = iterator.next(); if (obj instanceof Number) { Number n = (Number) obj; double v = n.doubleValue(); if (!Double.isNaN(v)) { vlist.add(n); } } }
while (iterator.hasNext()) { Object obj = iterator.next(); if (obj instanceof Number) { Number n = (Number) obj; double v = n.doubleValue(); if (!Double.isNaN(v)) { vlist.add(n); } } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/BoxAndWhiskerCalculator.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/DefaultMultiValueCategoryDataset.java
Method name: `BoxAndWhiskerItem calculateBoxAndWhiskerStatistics(List, boolean)` |  | Method name: `void add(List, Comparable, Comparable)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    while (iterator.hasNext()) {↵

1

    while (iterator.hasNext()) {↵

2

                    Object obj = iterator.next();↵

2

                Object obj = iterator.next();↵

3

                    if (obj instanceof Number) {↵

3

                if (obj instanceof Number) {↵

4

                        Number n = (Number) obj;↵

4

                    Number n = (Number) obj;↵

5

                        double v = n.doubleValue();↵

5

                    double v = n.doubleValue();↵

6

                        if (!Double.isNaN(v)) {↵

6

                    if (!Double.isNaN(v)) {↵

7

                            vlist.add(n);↵

7

                        vlist.add(n);↵

8

                        }↵

8

                    }↵

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.2
Clones location | Clones are in different classes
Number of node comparisons | 17

1. {Refactorable}

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

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

   7

       while (iterator.hasNext())

   9

       while (iterator.hasNext())

   8

       Object obj = iterator.next();

   10

       Object obj = iterator.next();

   9

       if (obj instanceof Number)

   11

       if (obj instanceof Number)

   10

       Number n = (Number)obj;

   12

       Number n = (Number)obj;

   11

       double v = n.doubleValue();

   13

       double v = n.doubleValue();

   12

       if (!Double.isNaN(v))

   14

       if (!Double.isNaN(v))

   13

       vlist.add(n);

   15

       vlist.add(n);

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