43-12-107

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 ControlPoint)) { return false; } ControlPoint that = (ControlPoint) obj; if (this.x != that.x) { return false; } /*&& y == ((ControlPoint) obj).y*/; 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/renderer/xy/XYSplineRenderer.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 9

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                    return true;↵

3

       ↵

3

       ↵

4

            }↵

4

             }↵

5

            if (!(obj instanceof OHLCDataItem)) {↵

5

                if (!(obj instanceof ControlPoint)) {↵

6

                return false;↵

6

                    return false;↵

7

            }↵

7

                }↵

8

            OHLCDataItem that = (OHLCDataItem) obj;↵

8

              ↵

9

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

10

                return false;   ↵

11

            }↵

9

      ControlPoint that = (ControlPoint) obj;↵

12

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

10

                if (this.↵

13

                return false;↵

14

            }↵

15

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

11

    x != that.x) {↵

16

                return false;   ↵

12

                    return false;↵

17

            }↵

13

          ↵

18

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

14

          ↵

19

                return false;   ↵

15

    }↵

20

            }↵

16

            ↵

21

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

17

        ↵

22

                return false;   ↵

18

    /*&& y == ((ControlPoint) obj).y*/;↵

23

            }↵

19

        ↵

24

            return true;

20

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

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.4
   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 ControlPoint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof ControlPoint))

   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 OHLCDataItem does not match with type boolean of variable obj instanceof ControlPoint
   2 | Conditional return true;
   3 | Conditional return true;
   4 | Conditional return false;
   5 | Conditional return false;