1559-1-4

double result = Double.NaN; Number n = (Number) this.seriesBarWidthList.get(series); if (n != null) { result = n.doubleValue(); } return result;
Number result = null; BoxAndWhiskerItem stats = (BoxAndWhiskerItem) this.items.get(item); if (stats != null) { result = stats.getQ1(); } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/LayeredBarRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/DefaultBoxAndWhiskerXYDataset.java
Method name: `double getSeriesBarWidth(int)` |  | Method name: `Number getQ1Value(int, int)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    double result = Double.NaN;↵

1

    Number result = null;↵

2

            Number n = (Number) this.seriesBarWidthList.get(series);↵

2

            BoxAndWhiskerItem stats = (BoxAndWhiskerItem) this.items.get(item);↵

3

            if (n != null) {↵

3

            if (stats != null) {↵

4

                result = n.doubleValue();↵

4

                result = stats.getQ1();↵

5

            }↵

5

            }↵

6

            return result;

6

            return result;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1
Clones location | Clones are in different classes
Number of node comparisons | 13

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 2
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 0.6
   Clone type | Type 2

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

   1

       double result = Double.NaN;

   2

       Number n = (Number)this.seriesBarWidthList.get(series);

   2 | Number n = (Number)this.seriesBarWidthList.get(series);
   1 | Number result = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   n | result | VARIABLE_NAME_MISMATCH
   (Number)this.seriesBarWidthList.get(series) | null | TYPE_COMPATIBLE_REPLACEMENT

   1

       Number result = null;

   2

       BoxAndWhiskerItem stats = (BoxAndWhiskerItem)this.items.get(item);

   3

       if (n != null)

   3 | if (n != null)
   3 | if (stats != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   n | stats | VARIABLE_NAME_MISMATCH
   java.lang.Number | org.jfree.data.statistics.BoxAndWhiskerItem | VARIABLE_TYPE_MISMATCH

   Preondition Violations
   Expression n cannot be parameterized, because it has dependencies to/from statements that will be extracted

   Type java.lang.Number of variable n does not match with type org.jfree.data.statistics.BoxAndWhiskerItem of variable stats
   - Make classes java.lang.Number and org.jfree.data.statistics.BoxAndWhiskerItem extend a common superclass

   3

       if (stats != null)

   4

       result = stats.getQ1();

   4

       result = n.doubleValue();

   5

       return result;

   5

       return result;

   5 | return result;

   Preondition Violations
   Unmatched return result;

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Expression n cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Type java.lang.Number of variable n does not match with type org.jfree.data.statistics.BoxAndWhiskerItem of variable stats
   3 | Unmatched return result;