23-2-5

if (obj == this) { return true; } if (!(obj instanceof CompassPlot)) { return false; } if (!super.equals(obj)) { return false; } CompassPlot that = (CompassPlot) obj; if (this.labelType != that.labelType) { return false; } if (!ObjectUtilities.equal(this.labelFont, that.labelFont)) { return false; } if (this.drawBorder != that.drawBorder) { return false; } if (!PaintUtilities.equal(this.roseHighlightPaint, that.roseHighlightPaint)) { return false; } if (!PaintUtilities.equal(this.rosePaint, that.rosePaint)) { return false; } if (!PaintUtilities.equal(this.roseCenterPaint, that.roseCenterPaint)) { return false; } if (!ObjectUtilities.equal(this.compassFont, that.compassFont)) { return false; } if (!Arrays.equals(this.seriesNeedle, that.seriesNeedle)) { return false; } if (getRevolutionDistance() != that.getRevolutionDistance()) { return false; } return true;
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;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CompassPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYPointerAnnotation.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 26 |  | 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 CompassPlot)) {↵

4

            if (!(obj instanceof XYPointerAnnotation)) {↵

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

            CompassPlot that = (CompassPlot) obj;↵

10

            XYPointerAnnotation that = (XYPointerAnnotation) obj;↵

11

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

11

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

12

                return false;↵

12

                return false;↵

13

            }↵

13

            }↵

14

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

14

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

15

                return false;↵

15

                return false;↵

16

            }↵

16

            }↵

17

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

17

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

18

                return false;↵

18

                return false;↵

19

            }↵

19

            }↵

20

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

20

            if (↵

21

                    that.roseHighlightPaint)) {↵

21

    this.arrowLength != that.arrowLength) {↵

22

                return false;↵

22

                return false;↵

23

            }↵

23

            }↵

24

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

24

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

25

                return false;↵

25

                return false;↵

26

            }↵

26

            }↵

27

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

27

            if (!this.arrowPaint.equals(th↵

28

                    that.roseCenterPaint)) {↵

28

    at.arrowPaint)) {↵

29

                return false;↵

29

                return false;↵

30

            }↵

30

            }↵

31

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

31

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

32

                return false;↵

32

                return false;↵

33

            }↵

33

            }↵

34

            if (!Arrays.equals(this.seriesNeedle, that.seriesNeedle)) {↵

34

            if (↵

35

                return false;↵

36

            }↵

37

            if (getRevolutionDistance() != that.getRevolutionDistance()) {↵

35

    this.labelOffset != that.labelOffset) {↵

38

                return false;↵

36

                return false;↵

39

            }↵

37

            }↵

40

            return true;

38

            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 | 178

1. {Non-refactorable}

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CompassPlot | org.jfree.chart.annotations.XYPointerAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof XYPointerAnnotation))

   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

       XYPointerAnnotation that = (XYPointerAnnotation)obj;

   7

       CompassPlot that = (CompassPlot)obj;

   8

       if (this.labelType != that.labelType)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.tipRadius != that.tipRadius)

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   12

       if (this.baseRadius != that.baseRadius)

   13 | return false;

   Preondition Violations
   Unmatched return false;

   13

       return false;

   14

       if (this.arrowLength != that.arrowLength)

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   16

       if (this.arrowWidth != that.arrowWidth)

   17 | return false;

   Preondition Violations
   Unmatched return false;

   17

       return false;

   18

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

   19 | return false;

   Preondition Violations
   Unmatched return false;

   19

       return false;

   10

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

   10 | if (! ObjectUtilities.equal(this.labelFont, that.labelFont))
   20 | if (! ObjectUtilities.equal(this.arrowStroke, that.arrowStroke))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   labelFont | arrowStroke | VARIABLE_NAME_MISMATCH
   java.awt.Font | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   20

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

   11

       return false;

   11 | return false;
   21 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   21

       return false;

   12

       if (this.drawBorder != that.drawBorder)

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

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

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

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

   17

       return false;

   17 | return false;

   Preondition Violations
   Unmatched return false;

   18

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

   19

       return false;

   19 | return false;

   Preondition Violations
   Unmatched return false;

   20

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

   21

       return false;

   21 | return false;

   Preondition Violations
   Unmatched return false;

   22

       if (!Arrays.equals(this.seriesNeedle, that.seriesNeedle))

   23

       return false;

   23 | return false;

   Preondition Violations
   Unmatched return false;

   24

       if (getRevolutionDistance() != that.getRevolutionDistance())

   24 | if (getRevolutionDistance() != that.getRevolutionDistance())
   8 | if (this.angle != that.angle)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   getRevolutionDistance() | this.angle | TYPE_COMPATIBLE_REPLACEMENT
   that.getRevolutionDistance() | that.angle | TYPE_COMPATIBLE_REPLACEMENT

   8

       if (this.angle != that.angle)

   25

       return false;

   25 | 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 CompassPlot does not match with type boolean of variable obj instanceof XYPointerAnnotation
   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 | Type java.awt.Font of variable this.labelFont does not match with type java.awt.Stroke of variable this.arrowStroke
   9 | Unmatched return false;
   10 | Unmatched return false;
   11 | Unmatched return false;
   12 | Unmatched return false;
   13 | Unmatched return false;
   14 | Unmatched return false;
   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;