23-3-8

if (obj == this) { return true; } if (!(obj instanceof XYTextAnnotation)) { return false; } if (!super.equals(obj)) { return false; } XYTextAnnotation that = (XYTextAnnotation) obj; if (!this.text.equals(that.text)) { return false; } if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.rotationAngle != that.rotationAngle) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { 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/XYTextAnnotation.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 XYTextAnnotation)) {↵

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

            XYTextAnnotation that = (XYTextAnnotation) obj;↵

10

            LegendTitle that = (LegendTitle) obj;↵

11

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

11

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

12

                return false;   ↵

12

                return false;   ↵

13

            }↵

13

            }↵

14

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

14

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

15

                return false;↵

15

                return false;   ↵

16

            }↵

16

            }↵

17

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

17

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

18

                return false;↵

18

                return false;   ↵

19

            }↵

19

            }↵

20

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

20

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

21

                return false;   ↵

21

                return false;   ↵

22

            }↵

22

            }↵

23

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

23

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

24

                return false;   ↵

24

                return false;   ↵

25

            }↵

25

            }↵

26

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

26

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

27

                return false;   ↵

27

                return false;   ↵

28

            }↵

28

            }↵

29

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

29

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

30

                return false;   ↵

30

                return false;   ↵

31

            }↵

31

            }↵

32

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

32

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

33

                return false;   ↵

33

                return false;   ↵

34

            }↵

34

            }↵

35

            return true;

35

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

1. {Non-refactorable}

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

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

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

   Preondition Violations

   Type boolean of variable obj instanceof XYTextAnnotation does not match with type boolean of variable obj instanceof LegendTitle
   - Make classes org.jfree.chart.annotations.XYTextAnnotation 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

       XYTextAnnotation that = (XYTextAnnotation)obj;

   10

       if (this.legendItemGraphicEdge != that.legendItemGraphicEdge)

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   12

       if (this.legendItemGraphicAnchor != that.legendItemGraphicAnchor)

   13 | return false;

   Preondition Violations
   Unmatched return false;

   13

       return false;

   14

       if (this.legendItemGraphicLocation != that.legendItemGraphicLocation)

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   8

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

   8 | if (! this.text.equals(that.text))
   16 | if (! this.itemFont.equals(that.itemFont))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.XYTextAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH
   text | itemFont | VARIABLE_NAME_MISMATCH
   java.lang.String | java.awt.Font | VARIABLE_TYPE_MISMATCH
   text | itemFont | VARIABLE_NAME_MISMATCH
   java.lang.String | java.awt.Font | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

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

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

   16

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

   9

       return false;

   9 | return false;
   17 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   17

       return false;

   10

       if (this.x != that.x)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (this.y != that.y)

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

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

   14 | if (! this.font.equals(that.font))
   18 | if (! this.itemPaint.equals(that.itemPaint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.XYTextAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH
   font | itemPaint | VARIABLE_NAME_MISMATCH
   java.awt.Font | java.awt.Paint | VARIABLE_TYPE_MISMATCH
   font | itemPaint | VARIABLE_NAME_MISMATCH
   java.awt.Font | java.awt.Paint | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

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

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

   18

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

   15

       return false;

   15 | return false;
   19 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   19

       return false;

   16

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

   16 | if (! PaintUtilities.equal(this.paint, that.paint))
   8 | if (! PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   paint | backgroundPaint | VARIABLE_NAME_MISMATCH
   org.jfree.chart.annotations.XYTextAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH
   paint | backgroundPaint | VARIABLE_NAME_MISMATCH

   Preondition Violations

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

   8

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

   17

       return false;

   17 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   18

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

   18 | if (! this.rotationAnchor.equals(that.rotationAnchor))
   20 | if (! this.hLayout.equals(that.hLayout))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.XYTextAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH
   rotationAnchor | hLayout | VARIABLE_NAME_MISMATCH
   org.jfree.ui.TextAnchor | org.jfree.chart.block.Arrangement | VARIABLE_TYPE_MISMATCH
   rotationAnchor | hLayout | VARIABLE_NAME_MISMATCH
   org.jfree.ui.TextAnchor | org.jfree.chart.block.Arrangement | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type org.jfree.ui.TextAnchor of variable that.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.hLayout
   - Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass

   Type org.jfree.ui.TextAnchor of variable this.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.hLayout
   - Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass

   20

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

   19

       return false;

   19 | return false;
   21 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   21

       return false;

   20

       if (this.rotationAngle != that.rotationAngle)

   21

       return false;

   21 | return false;

   Preondition Violations
   Unmatched return false;

   22

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

   22 | if (! this.textAnchor.equals(that.textAnchor))
   22 | if (! this.vLayout.equals(that.vLayout))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.XYTextAnnotation | org.jfree.chart.title.LegendTitle | VARIABLE_TYPE_MISMATCH
   textAnchor | vLayout | VARIABLE_NAME_MISMATCH
   org.jfree.ui.TextAnchor | org.jfree.chart.block.Arrangement | VARIABLE_TYPE_MISMATCH
   textAnchor | vLayout | VARIABLE_NAME_MISMATCH
   org.jfree.ui.TextAnchor | org.jfree.chart.block.Arrangement | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type org.jfree.ui.TextAnchor of variable that.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.vLayout
   - Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass

   Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.vLayout
   - Make classes org.jfree.ui.TextAnchor and org.jfree.chart.block.Arrangement extend a common superclass

   22

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

   23

       return false;

   23 | return false;
   23 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   23

       return false;

   Precondition Violations (36)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof XYTextAnnotation does not match with type boolean of variable obj instanceof LegendTitle
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Type org.jfree.chart.annotations.XYTextAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   6 | Type java.lang.String of variable that.text does not match with type java.awt.Font of variable that.itemFont
   7 | Type java.lang.String of variable this.text does not match with type java.awt.Font of variable this.itemFont
   8 | Unmatched return false;
   9 | Unmatched return false;
   10 | Type org.jfree.chart.annotations.XYTextAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   11 | Type java.awt.Font of variable that.font does not match with type java.awt.Paint of variable that.itemPaint
   12 | Type java.awt.Font of variable this.font does not match with type java.awt.Paint of variable this.itemPaint
   13 | Type org.jfree.chart.annotations.XYTextAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   14 | Type org.jfree.chart.annotations.XYTextAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   15 | Type org.jfree.ui.TextAnchor of variable that.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.hLayout
   16 | Type org.jfree.ui.TextAnchor of variable this.rotationAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.hLayout
   17 | Unmatched return false;
   18 | Type org.jfree.chart.annotations.XYTextAnnotation of variable that does not match with type org.jfree.chart.title.LegendTitle of variable that
   19 | Type org.jfree.ui.TextAnchor of variable that.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable that.vLayout
   20 | Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type org.jfree.chart.block.Arrangement of variable this.vLayout
   21 | Conditional return true;
   22 | Conditional return true;
   23 | Conditional return false;
   24 | Conditional return false;
   25 | Conditional return false;
   26 | Conditional return false;
   27 | Conditional return false;
   28 | Conditional return false;
   29 | Conditional return false;
   30 | Conditional return false;
   31 | Conditional return false;
   32 | Conditional return false;
   33 | Conditional return false;
   34 | Conditional return false;
   35 | Conditional return false;
   36 | Conditional return false;