43-2-29

if (obj == this) { return true; } if (!(obj instanceof ScatterRenderer)) { return false; } ScatterRenderer that = (ScatterRenderer) obj; if (!ObjectUtilities.equal(this.seriesShapesFilled, that.seriesShapesFilled)) { return false; } if (this.baseShapesFilled != that.baseShapesFilled) { return false; } if (this.useFillPaint != that.useFillPaint) { return false; } if (this.drawOutlines != that.drawOutlines) { return false; } if (this.useOutlinePaint != that.useOutlinePaint) { return false; } if (this.useSeriesOffset != that.useSeriesOffset) { return false; } if (this.itemMargin != that.itemMargin) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof CategoryItemEntity)) { return false; } CategoryItemEntity that = (CategoryItemEntity) obj; if (!this.rowKey.equals(that.rowKey)) { return false; } if (!this.columnKey.equals(that.columnKey)) { return false; } if (!ObjectUtilities.equal(this.dataset, that.dataset)) { return false; } // check the deprecated fields if (this.categoryIndex != that.categoryIndex) { return false; } if (this.series != that.series) { return false; } if (!ObjectUtilities.equal(this.category, that.category)) { return false; } return super.equals(obj);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/ScatterRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/entity/CategoryItemEntity.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 20 |  | Number of AST nodes: 18

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;      ↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof ScatterRenderer)) {↵

4

            if (!(obj instanceof CategoryItemEntity)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            ScatterRenderer that = (ScatterRenderer) obj;↵

7

            CategoryItemEntity that = (CategoryItemEntity) obj;↵

8

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

8

            if (!this.rowKey.equals(th↵

9

                    that.seriesShapesFilled)) {↵

9

    at.rowKey)) {↵

10

                return false;↵

10

                return false;↵

11

            }↵

11

            }↵

12

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

12

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

13

                return false;↵

13

                return false;↵

14

            }↵

14

            }↵

15

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

15

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

16

                return false;↵

16

                return false;↵

17

            }↵

17

            }↵

18

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

18

            ↵

19

                return false;↵

20

            }↵

19

            // check the deprecated fields↵

21

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

20

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

22

                return false;↵

21

                return false;   ↵

23

            }↵

22

            }↵

24

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

23

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

25

                return false;↵

24

                return false;   ↵

26

            }↵

25

            }↵

27

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

26

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

28

                return false;↵

27

                return false;   ↵

29

            }↵

28

            }↵

30

            return super.equals(obj);

29

            return super.equals(obj);

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 5
   Time elapsed for statement mapping (ms) | 0.9
   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 ScatterRenderer))

   3 | if (!(obj instanceof ScatterRenderer))
   3 | if (!(obj instanceof CategoryItemEntity))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.ScatterRenderer | org.jfree.chart.entity.CategoryItemEntity | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof ScatterRenderer does not match with type boolean of variable obj instanceof CategoryItemEntity
   - Make classes org.jfree.chart.renderer.category.ScatterRenderer and org.jfree.chart.entity.CategoryItemEntity extend a common superclass

   3

       if (!(obj instanceof CategoryItemEntity))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       CategoryItemEntity that = (CategoryItemEntity)obj;

   5

       ScatterRenderer that = (ScatterRenderer)obj;

   6

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

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   6

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

   6 | if (! ObjectUtilities.equal(this.seriesShapesFilled, that.seriesShapesFilled))
   10 | if (! ObjectUtilities.equal(this.dataset, that.dataset))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   seriesShapesFilled | dataset | VARIABLE_NAME_MISMATCH
   org.jfree.util.BooleanList | org.jfree.data.category.CategoryDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.util.BooleanList of variable this.seriesShapesFilled does not match with type org.jfree.data.category.CategoryDataset of variable this.dataset
   - Make classes org.jfree.util.BooleanList and org.jfree.data.category.CategoryDataset extend a common superclass

   10

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

   7

       return false;

   7 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   Precondition Violations (10)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof ScatterRenderer does not match with type boolean of variable obj instanceof CategoryItemEntity
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Type org.jfree.util.BooleanList of variable this.seriesShapesFilled does not match with type org.jfree.data.category.CategoryDataset of variable this.dataset
   5 | Conditional return true;
   6 | Conditional return true;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;