43-12-30

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

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/data/category/DefaultIntervalCategoryDataset.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 14

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 DefaultIntervalCategoryDataset)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            OHLCDataItem that = (OHLCDataItem↵

7

            DefaultIntervalCategoryDataset that ↵

8

    ) obj;↵

8

                    = (DefaultIntervalCategoryDataset) obj;↵

9

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

9

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

10

                return false;   ↵

10

                return false;↵

11

            }↵

11

            }↵

12

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

12

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

13

                return false;↵

13

                return false;↵

14

            }↵

14

            }↵

15

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

15

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

16

                return false;   ↵

16

                return false;↵

17

            }↵

17

            }↵

18

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

18

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

19

                return false;   ↵

19

                return false;↵

20

            }↵

20

            }↵

21

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

21

            ↵

22

                return false;   ↵

23

            }↵

22

    // seem to be the same...↵

24

            return true;

23

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

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 | 5
   Time elapsed for statement mapping (ms) | 1.2
   Clone type | Type 3

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.data.category.DefaultIntervalCategoryDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof DefaultIntervalCategoryDataset))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       DefaultIntervalCategoryDataset that = (DefaultIntervalCategoryDataset)obj;

   5

       OHLCDataItem that = (OHLCDataItem)obj;

   6

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

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   6

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

   6 | if (! this.date.equals(that.date))
   10 | if (! equal(this.startData, that.startData))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   equals | equal | METHOD_INVOCATION_NAME_MISMATCH
   this.date.equals(that.date) | equal(this.startData,that.startData) | ARGUMENT_NUMBER_MISMATCH
   this.date |  | MISSING_METHOD_INVOCATION_EXPRESSION

   10

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

   7

       return false;

   7 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   8

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

   8 | if (! this.high.equals(that.high))
   12 | if (! equal(this.endData, that.endData))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   equals | equal | METHOD_INVOCATION_NAME_MISMATCH
   this.high.equals(that.high) | equal(this.endData,that.endData) | ARGUMENT_NUMBER_MISMATCH
   this.high |  | MISSING_METHOD_INVOCATION_EXPRESSION

   12

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

   9

       return false;

   9 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   Precondition Violations (11)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof OHLCDataItem does not match with type boolean of variable obj instanceof DefaultIntervalCategoryDataset
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Conditional return true;
   5 | Conditional return true;
   6 | Conditional return false;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;