43-12-29

if (obj == this) { return true; } if (!(obj instanceof OHLCDataItem)) { return false; } OHLCDataItem that = (OHLCDataItem) obj; if (!this.date.equals(that.date)) { return false; } if (!this.high.equals(that.high)) { return false; } if (!this.low.equals(that.low)) { return false; } if (!this.open.equals(that.open)) { return false; } if (!this.close.equals(that.close)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof CategoryItemEntity)) { return false; } CategoryItemEntity that = (CategoryItemEntity) obj; if (!this.rowKey.equals(that.rowKey)) { return false; } if (!this.columnKey.equals(that.columnKey)) { return false; } if (!ObjectUtilities.equal(this.dataset, that.dataset)) { return false; } // check the deprecated fields if (this.categoryIndex != that.categoryIndex) { return false; } if (this.series != that.series) { return false; } if (!ObjectUtilities.equal(this.category, that.category)) { return false; } return super.equals(obj);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/xy/OHLCDataItem.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/CategoryItemEntity.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 18

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;   ↵

2

                return true;      ↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof OHLCDataItem)) {↵

4

            if (!(obj instanceof CategoryItemEntity)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            OHLCDataItem that = (OHLCDataItem) obj;↵

7

            CategoryItemEntity that = (CategoryItemEntity) obj;↵

8

            if (!this.date.equals(that.date)) {↵

8

            if (!this.rowKey.equals(that.rowKey)) {↵

9

                return false;   ↵

9

                return false;↵

10

            }↵

10

            }↵

11

            if (!this.high.equals(that.high)) {↵

11

            if (!this.columnKey.equals(that.columnKey)) {↵

12

                return false;↵

12

                return false;↵

13

            }↵

13

            }↵

14

            if (!this.low.equals(that.low)) {↵

14

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

15

                return false;↵

15

                return false;↵

16

       ↵

16

            }↵

17

            }↵

17

            ↵

18

            // check the deprecated fields↵

18

            if (!this.open.equals(that.open)↵

19

            if (this.categoryIndex != that.categoryIndex) {↵

20

                return false;   ↵

21

            }↵

19

    ) {↵

22

            if (this.series != that.series) {↵

20

                return false;   ↵

23

                return false;   ↵

21

            }↵

24

            }↵

22

            if (!this.close.equals(that.close)) {↵

25

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

23

                return false;   ↵

26

                return false;   ↵

24

            }↵

27

            }↵

25

            return true;

28

            return super.equals(obj);

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 | 87

1. {Non-refactorable}

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

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

   1

       if (obj == this)

   1

       if (obj == 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 OHLCDataItem))

   3 | if (!(obj instanceof OHLCDataItem))
   3 | if (!(obj instanceof CategoryItemEntity))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.entity.CategoryItemEntity | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof OHLCDataItem does not match with type boolean of variable obj instanceof CategoryItemEntity
   - Make classes org.jfree.data.xy.OHLCDataItem and org.jfree.chart.entity.CategoryItemEntity extend a common superclass

   3

       if (!(obj instanceof CategoryItemEntity))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       CategoryItemEntity that = (CategoryItemEntity)obj;

   5

       OHLCDataItem that = (OHLCDataItem)obj;

   6

       if (!this.date.equals(that.date))

   6 | if (! this.date.equals(that.date))
   6 | if (! this.rowKey.equals(that.rowKey))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.entity.CategoryItemEntity | VARIABLE_TYPE_MISMATCH
   date | rowKey | VARIABLE_NAME_MISMATCH
   date | rowKey | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.entity.CategoryItemEntity of variable that
   - Make classes org.jfree.data.xy.OHLCDataItem and org.jfree.chart.entity.CategoryItemEntity extend a common superclass

   6

       if (!this.rowKey.equals(that.rowKey))

   7

       return false;

   7 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

   8

       if (!this.high.equals(that.high))

   8 | if (! this.high.equals(that.high))
   8 | if (! this.columnKey.equals(that.columnKey))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.entity.CategoryItemEntity | VARIABLE_TYPE_MISMATCH
   high | columnKey | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.lang.Comparable | VARIABLE_TYPE_MISMATCH
   high | columnKey | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.lang.Comparable | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.entity.CategoryItemEntity of variable that
   - Make classes org.jfree.data.xy.OHLCDataItem and org.jfree.chart.entity.CategoryItemEntity extend a common superclass

   Type java.lang.Number of variable that.high does not match with type java.lang.Comparable of variable that.columnKey
   - Make classes java.lang.Number and java.lang.Comparable extend a common superclass

   Type java.lang.Number of variable this.high does not match with type java.lang.Comparable of variable this.columnKey
   - Make classes java.lang.Number and java.lang.Comparable extend a common superclass

   8

       if (!this.columnKey.equals(that.columnKey))

   9

       return false;

   9 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (13)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof OHLCDataItem does not match with type boolean of variable obj instanceof CategoryItemEntity
   2 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.entity.CategoryItemEntity of variable that
   3 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.entity.CategoryItemEntity of variable that
   4 | Type java.lang.Number of variable that.high does not match with type java.lang.Comparable of variable that.columnKey
   5 | Type java.lang.Number of variable this.high does not match with type java.lang.Comparable of variable this.columnKey
   6 | Conditional return true;
   7 | Conditional return true;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;