43-11-156

if (obj == this) { return true; } if (!(obj instanceof XYStepAreaRenderer)) { return false; } XYStepAreaRenderer that = (XYStepAreaRenderer) obj; if (this.showOutline != that.showOutline) { return false; } if (this.shapesVisible != that.shapesVisible) { return false; } if (this.shapesFilled != that.shapesFilled) { return false; } if (this.plotArea != that.plotArea) { return false; } if (this.rangeBase != that.rangeBase) { return false; } return super.equals(obj);
if (obj == this) { // simple case return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYDrawableAnnotation)) { return false; } XYDrawableAnnotation that = (XYDrawableAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (this.width != that.width) { return false; } if (this.height != that.height) { return false; } if (!ObjectUtilities.equal(this.drawable, that.drawable)) { 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/renderer/xy/XYStepAreaRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYDrawableAnnotation.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 18

1

    if (obj == this) {↵

1

    if (obj == this) { // simple case↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            // now try to reject equality...↵

5

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

6

                return false;↵

7

            }↵

4

            if (!(obj instanceof XYStepAreaRenderer)) {↵

8

            if (!(obj instanceof XYDrawableAnnotation)) {↵

5

                return false;↵

9

                return false;↵

6

            }↵

10

            }↵

7

            XYStepAreaRenderer that = (XYStepAreaRenderer) obj;↵

11

            XY↵

8

            if (this.showOutline != that.showOutline↵

12

    DrawableAnnotation that = (XYDrawableAnnotation) obj;↵

9

    ) {↵

13

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

10

                return false;↵

14

                return false;↵

11

            }↵

15

            }↵

12

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

16

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

13

                return false;↵

17

                return false;↵

14

            }↵

18

            }↵

15

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

19

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

16

                return false;↵

20

                return false;↵

17

            }↵

21

            }↵

18

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

22

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

19

                return false;↵

23

                return false;↵

20

            }↵

24

            }↵

21

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

25

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

22

                return false;↵

26

                return false;↵

23

            }↵

27

            }↵

24

            return super.equals(obj)↵

28

            // seem to be the same...↵

25

    ;

29

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 9
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 0.7
   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 XYStepAreaRenderer))

   3 | if (!(obj instanceof XYStepAreaRenderer))
   3 | if (! super.equals(obj))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   (obj instanceof XYStepAreaRenderer) | super.equals(obj) | TYPE_COMPATIBLE_REPLACEMENT

   3

       if (!super.equals(obj))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       if (!(obj instanceof XYDrawableAnnotation))

   6 | return false;

   Preondition Violations
   Unmatched return false;

   6

       return false;

   5

       XYStepAreaRenderer that = (XYStepAreaRenderer)obj;

   6

       if (this.showOutline != that.showOutline)

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       XYDrawableAnnotation that = (XYDrawableAnnotation)obj;

   8

       if (this.shapesVisible != that.shapesVisible)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.shapesFilled != that.shapesFilled)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (this.plotArea != that.plotArea)

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

       if (this.rangeBase != that.rangeBase)

   14 | if (this.rangeBase != that.rangeBase)
   8 | if (this.x != that.x)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   rangeBase | x | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.xy.XYStepAreaRenderer | org.jfree.chart.annotations.XYDrawableAnnotation | VARIABLE_TYPE_MISMATCH
   rangeBase | x | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.xy.XYStepAreaRenderer of variable that does not match with type org.jfree.chart.annotations.XYDrawableAnnotation of variable that
   - Make classes org.jfree.chart.renderer.xy.XYStepAreaRenderer and org.jfree.chart.annotations.XYDrawableAnnotation extend a common superclass

   8

       if (this.x != that.x)

   15

       return false;

   15 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Unmatched return false;
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Type org.jfree.chart.renderer.xy.XYStepAreaRenderer of variable that does not match with type org.jfree.chart.annotations.XYDrawableAnnotation of variable that
   7 | Conditional return true;
   8 | Conditional return true;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;