43-2-154

if (obj == this) { return true; } if (!(obj instanceof ScatterRenderer)) { return false; } ScatterRenderer that = (ScatterRenderer) obj; if (!ObjectUtilities.equal(this.seriesShapesFilled, that.seriesShapesFilled)) { return false; } if (this.baseShapesFilled != that.baseShapesFilled) { return false; } if (this.useFillPaint != that.useFillPaint) { return false; } if (this.drawOutlines != that.drawOutlines) { return false; } if (this.useOutlinePaint != that.useOutlinePaint) { return false; } if (this.useSeriesOffset != that.useSeriesOffset) { return false; } if (this.itemMargin != that.itemMargin) { 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/category/ScatterRenderer.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: 20 |  | Number of AST nodes: 16

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof ScatterRenderer)) {↵

4

            ↵

5

                return false;↵

6

            }↵

7

            ScatterRenderer that = (ScatterRenderer) obj;↵

8

            if (!ObjectUtilities.equal(this.seriesShapesFilled,↵

9

                    that.seriesShapesFilled↵

5

    // now try to reject equality...↵

10

    )) {↵

6

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

11

                return false;↵

7

                return false;↵

12

            }↵

8

            }↵

13

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

9

            if (!(obj instanceof XYImageAnnotation)) {↵

14

                return false;↵

10

                return false;↵

15

            }↵

11

            }↵

16

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

12

            XYImageAnnotation that = ↵

17

                return false;↵

18

            }↵

19

            if (this.drawOutlines != that.drawOutlines↵

13

    (XYImageAnnotation) obj;↵

20

    ) {↵

14

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

21

                return false;↵

15

                return false;↵

22

            }↵

16

            }↵

23

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

17

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

24

                return false;↵

18

                return false;↵

25

            }↵

19

            }↵

26

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

20

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

27

                return false;↵

21

                return false;↵

28

            }↵

22

            }↵

29

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

23

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

30

                return false;↵

24

                return false;↵

31

            }↵

25

            }↵

32

            return super.equals(obj)↵

26

            // seems to be the same...↵

33

    ;

27

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 11
   Number of unmapped statements in the second code fragment | 1
   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 ScatterRenderer))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.ScatterRenderer | org.jfree.chart.annotations.XYImageAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof ScatterRenderer does not match with type boolean of variable obj instanceof XYImageAnnotation
   - Make classes org.jfree.chart.renderer.category.ScatterRenderer 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

       ScatterRenderer that = (ScatterRenderer)obj;

   6

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

   6 | if (! ObjectUtilities.equal(this.seriesShapesFilled, that.seriesShapesFilled))
   3 | if (! super.equals(obj))

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

   3

       if (!super.equals(obj))

   7

       return false;

   7 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   7

       XYImageAnnotation that = (XYImageAnnotation)obj;

   8

       if (this.baseShapesFilled != that.baseShapesFilled)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.useFillPaint != that.useFillPaint)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (this.drawOutlines != that.drawOutlines)

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

       if (this.useOutlinePaint != that.useOutlinePaint)

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       if (this.useSeriesOffset != that.useSeriesOffset)

   17

       return false;

   17 | return false;

   Preondition Violations
   Unmatched return false;

   18

       if (this.itemMargin != that.itemMargin)

   18 | if (this.itemMargin != that.itemMargin)
   8 | if (this.x != that.x)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   itemMargin | x | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.category.ScatterRenderer | org.jfree.chart.annotations.XYImageAnnotation | VARIABLE_TYPE_MISMATCH
   itemMargin | x | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.category.ScatterRenderer of variable that does not match with type org.jfree.chart.annotations.XYImageAnnotation of variable that
   - Make classes org.jfree.chart.renderer.category.ScatterRenderer and org.jfree.chart.annotations.XYImageAnnotation extend a common superclass

   8

       if (this.x != that.x)

   19

       return false;

   19 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (15)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof ScatterRenderer does not match with type boolean of variable obj instanceof XYImageAnnotation
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Unmatched return false;
   7 | Type org.jfree.chart.renderer.category.ScatterRenderer of variable that does not match with type org.jfree.chart.annotations.XYImageAnnotation of variable that
   8 | Conditional return true;
   9 | Conditional return true;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;
   14 | Conditional return false;
   15 | Conditional return false;