43-124-156

if (obj == this) { return true; } if (!(obj instanceof StatisticalLineAndShapeRenderer)) { return false; } StatisticalLineAndShapeRenderer that = (StatisticalLineAndShapeRenderer) obj; if (!PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint)) { return false; } return super.equals(obj);
if (obj == this) { // simple case return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYDrawableAnnotation)) { return false; } XYDrawableAnnotation that = (XYDrawableAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (this.width != that.width) { return false; } if (this.height != that.height) { return false; } if (!ObjectUtilities.equal(this.drawable, that.drawable)) { 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/chart/renderer/category/StatisticalLineAndShapeRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYDrawableAnnotation.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 8 |  | Number of AST nodes: 18

1

    if (obj == this) {↵

1

    if (obj == this) { // simple case↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof StatisticalLineAndShapeRenderer)) {↵

4

            ↵

5

                return false;↵

6

            }↵

7

            StatisticalLineAndShapeRenderer that↵

5

    // now try to reject equality...↵

6

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

7

                return false;↵

8

            }↵

9

            if (!(obj instanceof XYDrawableAnnotation)) {↵

10

                return false;↵

8

            ↵

11

            }↵

9

            = (StatisticalLineAndShapeRenderer) obj;↵

12

            ↵

10

            if (!PaintUtilities.equal(this.errorIndicatorPaint,↵

13

    XYDrawableAnnotation that = (XYDrawableAnnotation) obj;↵

14

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

15

                return false;↵

16

            }↵

17

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

18

                return false;↵

19

            }↵

20

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

21

                return false;↵

11

            ↵

22

            }↵

12

            that.errorIndicatorPaint↵

23

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

24

                return false;↵

25

            }↵

13

    )) {↵

26

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

14

                return false;↵

27

                return false;↵

15

            }↵

28

            }↵

16

            return super.equals(obj)↵

29

            // seem to be the same...↵

17

    ;

30

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 11
   Time elapsed for statement mapping (ms) | 0.7
   Clone type | Type 3

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

   1

       if (obj == this)

   1

       if (obj == this)

   2

       return true;

   2

       return true;

   3

       if (!(obj instanceof StatisticalLineAndShapeRenderer))

   3 | if (!(obj instanceof StatisticalLineAndShapeRenderer))
   5 | if (!(obj instanceof XYDrawableAnnotation))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.StatisticalLineAndShapeRenderer | org.jfree.chart.annotations.XYDrawableAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   5

       if (!(obj instanceof XYDrawableAnnotation))

   4

       return false;

   6

       return false;

   5

       StatisticalLineAndShapeRenderer that = (StatisticalLineAndShapeRenderer)obj;

   6

       if (!PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint))

   6 | if (! PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint))
   3 | if (! super.equals(obj))

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

   3

       if (!super.equals(obj))

   7

       return false;

   4

       return false;

   7

       XYDrawableAnnotation that = (XYDrawableAnnotation)obj;

   8

       if (this.x != that.x)

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   10

       if (this.y != that.y)

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   12

       if (this.width != that.width)

   13 | return false;

   Preondition Violations
   Unmatched return false;

   13

       return false;

   14

       if (this.height != that.height)

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   16

       if (!ObjectUtilities.equal(this.drawable, that.drawable))

   17 | return false;

   Preondition Violations
   Unmatched return false;

   17

       return false;

   8

       return super.equals(obj);

   8 | return super.equals(obj);
   18 | return true;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   super.equals(obj) | true | TYPE_COMPATIBLE_REPLACEMENT

   18

       return true;

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof StatisticalLineAndShapeRenderer does not match with type boolean of variable obj instanceof XYDrawableAnnotation
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Unmatched return false;