402-5-6

if (obj == this) { return true; } if (!(obj instanceof DefaultIntervalCategoryDataset)) { return false; } DefaultIntervalCategoryDataset that = (DefaultIntervalCategoryDataset) obj; if (!Arrays.equals(this.seriesKeys, that.seriesKeys)) { return false; } if (!Arrays.equals(this.categoryKeys, that.categoryKeys)) { return false; } if (!equal(this.startData, that.startData)) { return false; } if (!equal(this.endData, that.endData)) { return false; } // seem to be the same... return true;
if (object == this) { return true; } if (!(object instanceof Task)) { return false; } Task that = (Task) object; if (!ObjectUtilities.equal(this.description, that.description)) { return false; } if (!ObjectUtilities.equal(this.duration, that.duration)) { return false; } if (!ObjectUtilities.equal(this.percentComplete, that.percentComplete)) { return false; } if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) { return false; } return true;

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

1

    if (obj == this) {↵

1

    if (object == this) {↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof DefaultIntervalCategoryDataset)) {↵

4

            if (!(object instanceof Task)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            DefaultIntervalCategoryDataset that ↵

7

            ↵

8

                    = (DefaultIntervalCategoryDataset) obj;↵

8

    Task that = (Task) object;↵

9

            if (!Arrays.equals(this.seriesKeys, that.seriesKeys)) {↵

9

            if (!ObjectUtilities.equal(this.description, that.description)) {↵

10

                return false;↵

10

                return false;↵

11

            }↵

11

            }↵

12

            if (!Arrays.equals(this.categoryKeys, that.categoryKeys)) {↵

12

            if (!ObjectUtilities.equal(this.duration, that.duration)) {↵

13

                return false;↵

13

                return false;↵

14

            }↵

14

            }↵

15

            if (!equal(this.startData, that.startData↵

15

            if (!ObjectUtilities.equal(this.percentComplete, ↵

16

    )) {↵

16

                    that.percentComplete)) {↵

17

                return false;↵

17

                return false;↵

18

            }↵

18

            }↵

19

            if (!equal(this.endData, that.endData)) {↵

19

            if (!ObjectUtilities.equal(this.subtasks, that.subtasks)) {↵

20

                return false;↵

20

                return false;↵

21

            }↵

21

            }↵

22

            // seem to be the same...↵

23

            return true;

22

            return true;

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) | 2.8
Clones location | Clones are in different classes
Number of node comparisons | 45

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   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.5
   Clone type | Type 2

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

   1

       if (obj == this)

   1 | if (obj == this)
   1 | if (object == this)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   obj | object | VARIABLE_NAME_MISMATCH

   1

       if (object == this)

   2

       return true;

   2 | return true;
   2 | return true;

   Preondition Violations
   Conditional return true;
   Conditional return true;

   2

       return true;

   3

       if (!(obj instanceof DefaultIntervalCategoryDataset))

   3 | if (!(obj instanceof DefaultIntervalCategoryDataset))
   3 | if (!(object instanceof Task))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   obj | object | VARIABLE_NAME_MISMATCH
   org.jfree.data.category.DefaultIntervalCategoryDataset | org.jfree.data.gantt.Task | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof DefaultIntervalCategoryDataset does not match with type boolean of variable object instanceof Task
   - Make classes org.jfree.data.category.DefaultIntervalCategoryDataset and org.jfree.data.gantt.Task extend a common superclass

   3

       if (!(object instanceof Task))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof DefaultIntervalCategoryDataset does not match with type boolean of variable object instanceof Task
   2 | Conditional return true;
   3 | Conditional return true;
   4 | Conditional return false;
   5 | Conditional return false;