43-105-154

if (obj == this) { return true; } if (!(obj instanceof XYAreaRenderer2)) { return false; } XYAreaRenderer2 that = (XYAreaRenderer2) obj; if (this.showOutline != that.showOutline) { return false; } if (!ShapeUtilities.equal(this.legendArea, that.legendArea)) { return false; } return super.equals(obj);
if (obj == this) { return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYImageAnnotation)) { return false; } XYImageAnnotation that = (XYImageAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!ObjectUtilities.equal(this.image, that.image)) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } // seems to be the same... return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYAreaRenderer2.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYImageAnnotation.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 10 |  | Number of AST nodes: 16

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

        ↵

2

                return true;↵

3

          ↵

3

            }↵

4

          return tru↵

4

            // now try to reject equality...↵

5

            if (!super.equals(obj)) {↵

5

    e;↵

6

                return false;↵

6

            }↵

7

            }↵

7

            if (!(obj instanceof XYAreaRenderer2)) {↵

8

            if (!(obj instanceof XYImageAnnotation)) {↵

8

                return false;↵

9

                return false;↵

9

            }↵

10

            }↵

10

            XYAreaRenderer2 that = (XYAreaRenderer2) obj;↵

11

            XY↵

11

            if (this.showOutline != that.showOutline↵

12

    ImageAnnotation that = (XYImageAnnotation) obj;↵

13

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

14

                return false;↵

15

            }↵

12

    ) {↵

16

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

13

                return false;↵

17

                return false;↵

14

            }↵

18

            }↵

15

            if (!ShapeUtilities.equal(this.legendArea, that.legendArea↵

19

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

20

                return false;↵

21

            }↵

16

    )) {↵

22

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

17

                return false;↵

23

                return false;↵

18

            }↵

24

            }↵

19

            return super.equals(obj)↵

25

            // seems to be the same...↵

20

    ;

26

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.5
   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 XYAreaRenderer2))

   3 | if (!(obj instanceof XYAreaRenderer2))
   5 | if (!(obj instanceof XYImageAnnotation))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.xy.XYAreaRenderer2 | org.jfree.chart.annotations.XYImageAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof XYAreaRenderer2 does not match with type boolean of variable obj instanceof XYImageAnnotation
   - Make classes org.jfree.chart.renderer.xy.XYAreaRenderer2 and org.jfree.chart.annotations.XYImageAnnotation extend a common superclass

   5

       if (!(obj instanceof XYImageAnnotation))

   4

       return false;

   4 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   5

       XYAreaRenderer2 that = (XYAreaRenderer2)obj;

   6

       if (this.showOutline != that.showOutline)

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

       if (!ShapeUtilities.equal(this.legendArea, that.legendArea))

   8 | if (! ShapeUtilities.equal(this.legendArea, that.legendArea))
   3 | if (! super.equals(obj))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   ShapeUtilities.equal(this.legendArea,that.legendArea) | super.equals(obj) | TYPE_COMPATIBLE_REPLACEMENT

   3

       if (!super.equals(obj))

   9

       return false;

   9 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

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