23-5-8

if (obj == this) { return true; } if (!(obj instanceof XYPointerAnnotation)) { return false; } if (!super.equals(obj)) { return false; } XYPointerAnnotation that = (XYPointerAnnotation) obj; if (this.angle != that.angle) { return false; } if (this.tipRadius != that.tipRadius) { return false; } if (this.baseRadius != that.baseRadius) { return false; } if (this.arrowLength != that.arrowLength) { return false; } if (this.arrowWidth != that.arrowWidth) { return false; } if (!this.arrowPaint.equals(that.arrowPaint)) { return false; } if (!ObjectUtilities.equal(this.arrowStroke, that.arrowStroke)) { return false; } if (this.labelOffset != that.labelOffset) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof LegendTitle)) { return false; } if (!super.equals(obj)) { return false; } LegendTitle that = (LegendTitle) obj; if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } if (this.legendItemGraphicEdge != that.legendItemGraphicEdge) { return false; } if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor) { return false; } if (this.legendItemGraphicLocation != that.legendItemGraphicLocation) { return false; } if (!this.itemFont.equals(that.itemFont)) { return false; } if (!this.itemPaint.equals(that.itemPaint)) { return false; } if (!this.hLayout.equals(that.hLayout)) { return false; } if (!this.vLayout.equals(that.vLayout)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYPointerAnnotation.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/LegendTitle.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 24 |  | Number of AST nodes: 24

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;   ↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof XYPointerAnnotation)) {↵

4

            if (!(obj instanceof LegendTitle)) {↵

5

                return false;↵

5

                return false;   ↵

6

            }↵

6

            }↵

7

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

7

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

8

                return false;↵

8

                return false;   ↵

9

            }↵

9

            }↵

10

            XYPointerAnnotation that = (XYPointerAnnotation) obj;↵

10

            ↵

11

            if (this.angle != that.angle↵

11

    LegendTitle that = (LegendTitle) obj;↵

12

    ) {↵

12

            if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) {↵

13

                return false;↵

13

                return false;   ↵

14

            }↵

14

            }↵

15

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

15

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

16

                return false;↵

16

                return false;   ↵

17

            }↵

17

            }↵

18

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

18

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

19

                return false;↵

19

                return false;   ↵

20

            }↵

20

            }↵

21

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

21

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

22

                return false;↵

22

                return false;   ↵

23

            }↵

23

            }↵

24

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

24

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

25

                return false;↵

25

                return false;   ↵

26

            }↵

26

            }↵

27

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

27

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

28

                return false;↵

28

                return false;   ↵

29

            }↵

29

            }↵

30

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

30

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

31

                return false;↵

31

                return false;   ↵

32

            }↵

32

            }↵

33

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

33

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

34

                return false;↵

34

                return false;   ↵

35

            }↵

35

            }↵

36

            return true;

36

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 10
   Number of unmapped statements in the first code fragment | 11
   Number of unmapped statements in the second code fragment | 7
   Time elapsed for statement mapping (ms) | 3.0
   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 XYPointerAnnotation))

   3 | if (!(obj instanceof XYPointerAnnotation))
   3 | if (!(obj instanceof LegendTitle))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.XYPointerAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof XYPointerAnnotation does not match with type boolean of variable obj instanceof LegendTitle
   - Make classes org.jfree.chart.annotations.XYPointerAnnotation and org.jfree.chart.title.LegendTitle extend a common superclass

   3

       if (!(obj instanceof LegendTitle))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       if (!super.equals(obj))

   5

       if (!super.equals(obj))

   6

       return false;

   6 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   7

       LegendTitle that = (LegendTitle)obj;

   7

       XYPointerAnnotation that = (XYPointerAnnotation)obj;

   8

       if (this.angle != that.angle)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.legendItemGraphicEdge != that.legendItemGraphicEdge)

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   10

       if (this.tipRadius != that.tipRadius)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor)

   13 | return false;

   Preondition Violations
   Unmatched return false;

   13

       return false;

   12

       if (this.baseRadius != that.baseRadius)

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

       if (this.legendItemGraphicLocation != that.legendItemGraphicLocation)

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   14

       if (this.arrowLength != that.arrowLength)

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       if (this.arrowWidth != that.arrowWidth)

   17

       return false;

   17 | return false;

   Preondition Violations
   Unmatched return false;

   18

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

   18 | if (! this.arrowPaint.equals(that.arrowPaint))
   16 | if (! this.itemFont.equals(that.itemFont))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.XYPointerAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH
   arrowPaint | itemFont | VARIABLE_NAME_MISMATCH
   java.awt.Paint | java.awt.Font | VARIABLE_TYPE_MISMATCH
   arrowPaint | itemFont | VARIABLE_NAME_MISMATCH
   java.awt.Paint | java.awt.Font | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.annotations.XYPointerAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   - Make classes org.jfree.chart.annotations.XYPointerAnnotation and org.jfree.chart.title.LegendTitle extend a common superclass

   Type java.awt.Paint of variable that.arrowPaint does not match with type java.awt.Font of variable that.itemFont
   - Make classes java.awt.Paint and java.awt.Font extend a common superclass

   Type java.awt.Paint of variable this.arrowPaint does not match with type java.awt.Font of variable this.itemFont
   - Make classes java.awt.Paint and java.awt.Font extend a common superclass

   16

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

   19

       return false;

   19 | return false;
   17 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   17

       return false;

   20

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

   20 | if (! ObjectUtilities.equal(this.arrowStroke, that.arrowStroke))
   8 | if (! PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   arrowStroke | backgroundPaint | VARIABLE_NAME_MISMATCH
   java.awt.Stroke | java.awt.Paint | VARIABLE_TYPE_MISMATCH
   org.jfree.util.ObjectUtilities | org.jfree.util.PaintUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Stroke of variable this.arrowStroke does not match with type java.awt.Paint of variable this.backgroundPaint
   - Make classes java.awt.Stroke and java.awt.Paint extend a common superclass

   Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   - Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass

   8

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

   21

       return false;

   21 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (24)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof XYPointerAnnotation does not match with type boolean of variable obj instanceof LegendTitle
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Unmatched return false;
   7 | Unmatched return false;
   8 | Unmatched return false;
   9 | Unmatched return false;
   10 | Type org.jfree.chart.annotations.XYPointerAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   11 | Type java.awt.Paint of variable that.arrowPaint does not match with type java.awt.Font of variable that.itemFont
   12 | Type java.awt.Paint of variable this.arrowPaint does not match with type java.awt.Font of variable this.itemFont
   13 | Type java.awt.Stroke of variable this.arrowStroke does not match with type java.awt.Paint of variable this.backgroundPaint
   14 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   15 | Conditional return true;
   16 | Conditional return true;
   17 | Conditional return false;
   18 | Conditional return false;
   19 | Conditional return false;
   20 | Conditional return false;
   21 | Conditional return false;
   22 | Conditional return false;
   23 | Conditional return false;
   24 | Conditional return false;