43-153-157

if (obj == this) { return true; } if (!(obj instanceof NumberAxis)) { return false; } if (!super.equals(obj)) { return false; } NumberAxis that = (NumberAxis) obj; if (this.autoRangeIncludesZero != that.autoRangeIncludesZero) { return false; } if (this.autoRangeStickyZero != that.autoRangeStickyZero) { return false; } if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) { return false; } if (!ObjectUtilities.equal(this.numberFormatOverride, that.numberFormatOverride)) { return false; } if (!this.rangeType.equals(that.rangeType)) { return false; } return true;
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;

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

4

            // now try to reject equality↵

5

    )) {↵

5

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

6

                return false;↵

6

                return false;↵

7

            }↵

7

            }↵

8

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

8

            if (!(obj instanceof XYPolygonAnnotation)) {↵

9

                return false;↵

9

                return false;↵

10

            }↵

10

            }↵

11

            NumberAxis that = (NumberAxis) obj;↵

11

            XYPolygonAnnotation that = (XYPolygonAnnotation) obj;↵

12

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

12

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

13

                return false;↵

13

                return false;   ↵

14

            }↵

14

            }↵

15

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

15

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

16

                return false;↵

16

                return false;↵

17

            }↵

17

            }↵

18

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

18

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

19

                return false;↵

19

                return false;↵

20

            }↵

20

            }↵

21

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

21

            if (!PaintUtilities.equal(this.↵

22

                    that.numberFormatOverride)) {↵

23

                return false;↵

24

            }↵

25

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

26

                return false;↵

27

            }↵

22

    fillPaint, that.fillPaint)) {↵

23

                return false;↵

24

            }↵

25

            // seem to be the same↵

28

            return true;

26

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

1. {Non-refactorable}

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

   3 | if (!(obj instanceof NumberAxis))
   5 | if (!(obj instanceof XYPolygonAnnotation))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.NumberAxis | org.jfree.chart.annotations.XYPolygonAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   5

       if (!(obj instanceof XYPolygonAnnotation))

   4

       return false;

   4 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   5

       if (!super.equals(obj))

   3

       if (!super.equals(obj))

   6

       return false;

   6 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   7

       XYPolygonAnnotation that = (XYPolygonAnnotation)obj;

   7

       NumberAxis that = (NumberAxis)obj;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   8

       if (this.autoRangeIncludesZero != that.autoRangeIncludesZero)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.autoRangeStickyZero != that.autoRangeStickyZero)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

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

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

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

   Preondition Violations

   Type org.jfree.chart.axis.NumberTickUnit of variable this.tickUnit does not match with type java.awt.Paint of variable this.outlinePaint
   - Make classes org.jfree.chart.axis.NumberTickUnit 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

   12

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

   13

       return false;

   13 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   14

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   numberFormatOverride | stroke | VARIABLE_NAME_MISMATCH
   java.text.NumberFormat | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.text.NumberFormat of variable this.numberFormatOverride does not match with type java.awt.Stroke of variable this.stroke
   - Make classes java.text.NumberFormat and java.awt.Stroke extend a common superclass

   10

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

   15

       return false;

   15 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   Precondition Violations (17)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof NumberAxis does not match with type boolean of variable obj instanceof XYPolygonAnnotation
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Type org.jfree.chart.axis.NumberTickUnit of variable this.tickUnit does not match with type java.awt.Paint of variable this.outlinePaint
   6 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   7 | Type java.text.NumberFormat of variable this.numberFormatOverride does not match with type java.awt.Stroke of variable this.stroke
   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;
   16 | Conditional return false;
   17 | Conditional return false;