43-12-84

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 BlockBorder)) { return false; } BlockBorder that = (BlockBorder) obj; if (!this.insets.equals(that.insets)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } 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/chart/block/BlockBorder.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 10

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

5

                return false;↵

5

                return false;   ↵

6

            }↵

6

            }↵

7

            OHLCDataItem that = (OHLCDataItem) obj;↵

7

            BlockBorder that = (BlockBorder) obj;↵

8

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

8

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

9

                return false;   ↵

9

                return false;   ↵

10

            }↵

10

            }↵

11

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

11

            if (!↵

12

                return false;↵

13

            }↵

14

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

12

    PaintUtilities.equal(th↵

15

                return false;   ↵

16

            }↵

17

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

18

                return false;   ↵

19

            }↵

20

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

13

    is.paint, that.paint)) {↵

21

                return false;   ↵

14

                return false;↵

22

            }↵

15

            }↵

23

            return true;

16

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   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.6
   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 BlockBorder))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.block.BlockBorder | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof BlockBorder))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       BlockBorder that = (BlockBorder)obj;

   5

       OHLCDataItem that = (OHLCDataItem)obj;

   6

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.block.BlockBorder | VARIABLE_TYPE_MISMATCH
   date | insets | VARIABLE_NAME_MISMATCH
   java.util.Date | org.jfree.ui.RectangleInsets | VARIABLE_TYPE_MISMATCH
   date | insets | VARIABLE_NAME_MISMATCH
   java.util.Date | org.jfree.ui.RectangleInsets | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type java.util.Date of variable that.date does not match with type org.jfree.ui.RectangleInsets of variable that.insets
   - Make classes java.util.Date and org.jfree.ui.RectangleInsets extend a common superclass

   Type java.util.Date of variable this.date does not match with type org.jfree.ui.RectangleInsets of variable this.insets
   - Make classes java.util.Date and org.jfree.ui.RectangleInsets extend a common superclass

   6

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

   7

       return false;

   7 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

   Precondition Violations (10)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof OHLCDataItem does not match with type boolean of variable obj instanceof BlockBorder
   2 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.block.BlockBorder of variable that
   3 | Type java.util.Date of variable that.date does not match with type org.jfree.ui.RectangleInsets of variable that.insets
   4 | Type java.util.Date of variable this.date does not match with type org.jfree.ui.RectangleInsets of variable this.insets
   5 | Conditional return true;
   6 | Conditional return true;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;