322-1-3

if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYPolygonAnnotation)) { return false; } XYPolygonAnnotation that = (XYPolygonAnnotation) obj; if (!Arrays.equals(this.polygon, that.polygon)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } // seem to be the same return true;
if (obj == this) { return true; } if (!(obj instanceof DateAxis)) { return false; } DateAxis that = (DateAxis) obj; if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) { return false; } if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride)) { return false; } if (!ObjectUtilities.equal(this.tickMarkPosition, that.tickMarkPosition)) { return false; } if (!ObjectUtilities.equal(this.timeline, that.timeline)) { return false; } if (!super.equals(obj)) { return false; } return true;

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

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            // now try to reject equality↵

5

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

6

                return false;↵

7

            }↵

8

            if (!(obj instanceof XYPolygonAnnotation)) {↵

4

            if (!(obj instanceof DateAxis)) {↵

9

                return false;↵

5

                return false;↵

10

            }↵

6

            }↵

11

            XYPolygonAnnotation that = (XYPolygonAnnotation) obj;↵

7

            DateAxis that = (DateAxis) obj;↵

12

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

8

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

13

                return false;   ↵

9

                return false;↵

14

            }↵

10

            }↵

15

            if (!ObjectUtilities.equal(this.stroke, that.strok↵

11

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

16

    e)) {↵

12

                    that.dateFormatOverride)) {↵

17

                return false;↵

13

                return false;↵

18

            }↵

14

            }↵

19

            if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint↵

15

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

20

    )) {↵

16

                    that.tickMarkPosition)) {↵

21

                return false;↵

17

                return false;↵

22

            }↵

18

            }↵

23

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

19

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

24

                return false;↵

20

                return false;↵

25

            }↵

21

            }↵

26

            // seem to be the same↵

22

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

23

                return false;↵

24

            }↵

27

            return true;

25

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 14
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 2.1
   Clone type | Type 2

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

   5

       DateAxis that = (DateAxis)obj;

   7

       XYPolygonAnnotation that = (XYPolygonAnnotation)obj;

   8

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

   8

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

   10

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

   10 | if (! ObjectUtilities.equal(this.stroke, that.stroke))
   10 | if (! ObjectUtilities.equal(this.tickMarkPosition, that.tickMarkPosition))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   stroke | tickMarkPosition | VARIABLE_NAME_MISMATCH
   java.awt.Stroke | org.jfree.chart.axis.DateTickMarkPosition | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable this.tickMarkPosition
   - Make classes java.awt.Stroke and org.jfree.chart.axis.DateTickMarkPosition extend a common superclass

   10

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

   11

       return false;

   11

       return false;

   12

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

   12 | if (! PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
   12 | if (! ObjectUtilities.equal(this.timeline, that.timeline))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   outlinePaint | timeline | VARIABLE_NAME_MISMATCH
   java.awt.Paint | org.jfree.chart.axis.Timeline | VARIABLE_TYPE_MISMATCH
   org.jfree.util.PaintUtilities | org.jfree.util.ObjectUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Paint of variable this.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable this.timeline
   - Make classes java.awt.Paint and org.jfree.chart.axis.Timeline extend a common superclass

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

   12

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

   13

       return false;

   13

       return false;

   14

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

   14 | if (! PaintUtilities.equal(this.fillPaint, that.fillPaint))
   6 | if (! ObjectUtilities.equal(this.tickUnit, that.tickUnit))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   fillPaint | tickUnit | VARIABLE_NAME_MISMATCH
   java.awt.Paint | org.jfree.chart.axis.DateTickUnit | VARIABLE_TYPE_MISMATCH
   org.jfree.util.PaintUtilities | org.jfree.util.ObjectUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Paint of variable this.fillPaint does not match with type org.jfree.chart.axis.DateTickUnit of variable this.tickUnit
   - Make classes java.awt.Paint and org.jfree.chart.axis.DateTickUnit extend a common superclass

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

   6

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

   15

       return false;

   7

       return false;

   16

       return true;

   16

       return true;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.axis.DateTickMarkPosition of variable this.tickMarkPosition
   2 | Type java.awt.Paint of variable this.outlinePaint does not match with type org.jfree.chart.axis.Timeline of variable this.timeline
   3 | Type org.jfree.util.PaintUtilities of variable PaintUtilities does not match with type org.jfree.util.ObjectUtilities of variable ObjectUtilities
   4 | Type java.awt.Paint of variable this.fillPaint does not match with type org.jfree.chart.axis.DateTickUnit of variable this.tickUnit
   5 | Type org.jfree.util.PaintUtilities of variable PaintUtilities does not match with type org.jfree.util.ObjectUtilities of variable ObjectUtilities