1250-3-22

Number result = null; BoxAndWhiskerItem item = (BoxAndWhiskerItem) this.data.getObject(row, column); if (item != null) { result = item.getMean(); } return result;
Number result = null; MeanAndStandardDeviation masd = (MeanAndStandardDeviation) this.data.getObject(rowKey, columnKey); if (masd != null) { result = masd.getMean(); } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/DefaultBoxAndWhiskerCategoryDataset.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/DefaultStatisticalCategoryDataset.java
Method name: `Number getMeanValue(int, int)` |  | Method name: `Number getMeanValue(Comparable, Comparable)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    Number result = null;↵

1

    Number result = null;↵

2

            BoxAndWhiskerItem item = (BoxAndWhiskerItem)↵

2

            MeanAndStandardDeviation masd = (MeanAndStandardDeviation) ↵

3

     this.data.getObject(row, ↵

3

                    this.data.getObject(row↵

4

                    column);↵

4

    Key, columnKey);↵

5

            if (item != null) {↵

5

            if (masd != null) {↵

6

                result = item.getMean();↵

6

                result = masd.getMean();↵

7

            }↵

7

            }↵

8

            return result;

8

            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 having the same super class
Number of node comparisons | 13

1. {Non-refactorable}

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

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

   1

       Number result = null;

   1

       Number result = null;

   2

       MeanAndStandardDeviation masd = (MeanAndStandardDeviation)this.data.getObject(rowKey, columnKey);

   2

       BoxAndWhiskerItem item = (BoxAndWhiskerItem)this.data.getObject(row, column);

   3

       if (item != null)

   3 | if (item != null)
   3 | if (masd != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   item | masd | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.BoxAndWhiskerItem | org.jfree.data.statistics.MeanAndStandardDeviation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.statistics.BoxAndWhiskerItem of variable item does not match with type org.jfree.data.statistics.MeanAndStandardDeviation of variable masd
   - Make classes org.jfree.data.statistics.BoxAndWhiskerItem and org.jfree.data.statistics.MeanAndStandardDeviation extend a common superclass

   3

       if (masd != null)

   4

       result = item.getMean();

   4 | result = item.getMean();
   4 | result = masd.getMean();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   item | masd | VARIABLE_NAME_MISMATCH
   org.jfree.data.statistics.BoxAndWhiskerItem | org.jfree.data.statistics.MeanAndStandardDeviation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.statistics.BoxAndWhiskerItem of variable item does not match with type org.jfree.data.statistics.MeanAndStandardDeviation of variable masd
   - Make classes org.jfree.data.statistics.BoxAndWhiskerItem and org.jfree.data.statistics.MeanAndStandardDeviation extend a common superclass

   4

       result = masd.getMean();

   5

       return result;

   5

       return result;

   Precondition Violations (2)
   Row | Violation
   --- | ---
   1 | Type org.jfree.data.statistics.BoxAndWhiskerItem of variable item does not match with type org.jfree.data.statistics.MeanAndStandardDeviation of variable masd
   2 | Type org.jfree.data.statistics.BoxAndWhiskerItem of variable item does not match with type org.jfree.data.statistics.MeanAndStandardDeviation of variable masd