43-112-158

if (obj == this) { return true; } if (!(obj instanceof DatasetGroup)) { return false; } DatasetGroup that = (DatasetGroup) obj; if (!this.id.equals(that.id)) { return false; } return true;
if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof WaterfallBarRenderer)) { return false; } WaterfallBarRenderer that = (WaterfallBarRenderer) obj; if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint)) { return false; } if (!PaintUtilities.equal(this.lastBarPaint, that.lastBarPaint)) { return false; } if (!PaintUtilities.equal(this.positiveBarPaint, that.positiveBarPaint)) { return false; } if (!PaintUtilities.equal(this.negativeBarPaint, that.negativeBarPaint)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/general/DatasetGroup.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/WaterfallBarRenderer.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 8 |  | Number of AST nodes: 16

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;   ↵

2

                return true;↵

3

            }↵

4

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

5

                return false;↵

3

            }↵

6

            }↵

4

            if (!(obj instanceof DatasetGroup)) {↵

7

            if (!(obj instanceof WaterfallBarRenderer)) {↵

5

                return false;   ↵

8

                return false;↵

6

            }↵

9

            }↵

7

            DatasetGroup that = (DatasetGroup) obj;↵

10

            WaterfallBarRenderer that = (WaterfallBarRenderer) obj;↵

8

            if (!this.id.equals(that.id↵

11

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

12

                return false;↵

13

            }↵

14

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

15

                return false;↵

16

            }↵

17

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

9

    )) {↵

18

                    that.positiveBarPaint)) {↵

10

                return false;↵

19

                return false;↵

11

       ↵

20

            }↵

21

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

22

                    that.negativeBarPaint)) {↵

23

                return false;↵

12

            }↵

24

            }↵

13

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 9
   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;

   3

       if (!(obj instanceof DatasetGroup))

   3 | if (!(obj instanceof DatasetGroup))
   5 | if (!(obj instanceof WaterfallBarRenderer))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.general.DatasetGroup | org.jfree.chart.renderer.category.WaterfallBarRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof DatasetGroup does not match with type boolean of variable obj instanceof WaterfallBarRenderer
   - Make classes org.jfree.data.general.DatasetGroup and org.jfree.chart.renderer.category.WaterfallBarRenderer extend a common superclass

   5

       if (!(obj instanceof WaterfallBarRenderer))

   4

       return false;

   6

       return false;

   5

       DatasetGroup that = (DatasetGroup)obj;

   6

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

   6 | if (! this.id.equals(that.id))
   3 | if (! super.equals(obj))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this.id.equals(that.id) | super.equals(obj) | TYPE_COMPATIBLE_REPLACEMENT

   3

       if (!super.equals(obj))

   7

       return false;

   4

       return false;

   7

       WaterfallBarRenderer that = (WaterfallBarRenderer)obj;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   10

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

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   12

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

   13 | return false;

   Preondition Violations
   Unmatched return false;

   13

       return false;

   14

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

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   8

       return true;

   16

       return true;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof DatasetGroup does not match with type boolean of variable obj instanceof WaterfallBarRenderer
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;