177-2-3

for (int r = 0; r < rowCount; r++) { for (int c = 0; c < colCount; c++) { Number v1 = getValue(r, c); Number v2 = that.getValue(r, c); if (v1 == null) { if (v2 != null) { return false; } } else if (!v1.equals(v2)) { return false; } } }
for (int r = 0; r < rowCount; r++) { for (int c = 0; c < colCount; c++) { Object v1 = getObject(r, c); Object v2 = that.getObject(r, c); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } } } }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/category/DefaultCategoryDataset.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/KeyedObjects2D.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 9 |  | Number of AST nodes: 9

1

    for (int r = 0; r < rowCount; r++) {↵

1

    for (int r = 0; r < rowCount; r++) {↵

2

                for (int c = 0; c < colCount; c++) {↵

2

                for (int c = 0; c < colCount; c++) {↵

3

                    Number v1 = getValue(r, c);↵

3

                    Object v1 = getObject(r, c);↵

4

                    Number v2 = that.getValue(r, c);↵

4

                    Object v2 = that.getObject(r, c);↵

5

                    if (v1 == null) {↵

5

                    if (v1 == null) {↵

6

                        if (v2 != null) {↵

6

                        if (v2 != null) {↵

7

                            return false;↵

7

                            return false;↵

8

                        }↵

8

                        }↵

9

                    }↵

9

                    }↵

10

                    else ↵

10

                    else {↵

11

    if (!v1.equals(v2)) {↵

11

                        if (!v1.equals(v2)) {↵

12

                        return false;↵

12

                            return false;↵

13

                        }↵

13

                    }↵

14

                    }↵

14

                }↵

15

                }↵

15

            }

16

            }

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

1. {Non-refactorable}

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

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

   17

       if (v2 != null)

   17 | if (v2 != null)
   21 | if (v2 != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.lang.Number | java.lang.Object | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable v2
   - Make classes java.lang.Number and java.lang.Object extend a common superclass

   21

       if (v2 != null)

   18

       return false;

   18 | return false;
   22 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   22

       return false;

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable v2
   2 | Conditional return false;
   3 | Conditional return false;