1022-3-4

for (int c = 0; c < colCount; c++) { Number v1 = getValue(r, c); Number v2 = kv2D.getValue(r, c); if (v1 == null) { if (v2 != null) { return false; } } else { if (!v1.equals(v2)) { return false; } } }
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/DefaultKeyedValues2D.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: 8 |  | Number of AST nodes: 8

1

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

1

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

2

                    Number v1 = getValue(r, c);↵

2

                    Object v1 = getObject(r, c);↵

3

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

3

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

4

                    if (v1 == null) {↵

4

                    if (v1 == null) {↵

5

                        if (v2 != null) {↵

5

                        if (v2 != null) {↵

6

                            return false;↵

6

                            return false;↵

7

                        }↵

7

                        }↵

8

                    }↵

8

                    }↵

9

                    else {↵

9

                    else {↵

10

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

10

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

11

                            return false;↵

11

                            return false;↵

12

                        }↵

12

                        }↵

13

                    }↵

13

                    }↵

14

                }

14

                }

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

1. {Non-refactorable}

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

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

   19

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

   17

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

   18 | Object v1 = getObject(r, c);

   Preondition Violations
   Unmatched statement Object v1=getObject(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   18

       Object v1 = getObject(r, c);

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

   Preondition Violations
   Unmatched statement Object v2=that.getObject(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   19

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

   20

       Number v1 = getValue(r, c);

   20 | Number v1 = getValue(r, c);

   Preondition Violations
   Unmatched statement Number v1=getValue(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   21

       Number v2 = kv2D.getValue(r, c);

   21 | Number v2 = kv2D.getValue(r, c);

   Preondition Violations
   Unmatched statement Number v2=kv2D.getValue(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   22

       if (v1 == null)

   22 | if (v1 == null)
   20 | if (v1 == null)

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

   Preondition Violations

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

   20

       if (v1 == null)

   23

       if (v2 != null)

   23 | 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)

   24

       return false;

   24 | return false;
   22 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   22

       return false;

       else

       else

   25

       if (!v1.equals(v2))

   25 | if (! v1.equals(v2))
   23 | if (! v1.equals(v2))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.lang.Number | java.lang.Object | VARIABLE_TYPE_MISMATCH
   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

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

   23

       if (!v1.equals(v2))

   26

       return false;

   26 | return false;
   24 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   24

       return false;

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Unmatched statement Object v1=getObject(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   2 | Unmatched statement Object v2=that.getObject(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Unmatched statement Number v1=getValue(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   4 | Unmatched statement Number v2=kv2D.getValue(r,c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   5 | Type java.lang.Number of variable v1 does not match with type java.lang.Object of variable v1
   6 | Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable v2
   7 | Type java.lang.Number of variable v2 does not match with type java.lang.Object of variable v2
   8 | Type java.lang.Number of variable v1 does not match with type java.lang.Object of variable v1
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;