43-115-158

if (obj == this) { return true; } if (!(obj instanceof BlockContainer)) { return false; } if (!super.equals(obj)) { return false; } BlockContainer that = (BlockContainer) obj; if (!this.arrangement.equals(that.arrangement)) { return false; } if (!this.blocks.equals(that.blocks)) { 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/chart/block/BlockContainer.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: 12 |  | Number of AST nodes: 16

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;↵

3

       ↵

3

            }↵

4

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

5

                return false;↵

4

            }↵

6

            }↵

5

            if (!(obj instanceof BlockContainer)) {↵

7

            if (!(obj instanceof WaterfallBarRenderer)) {↵

6

                return false;↵

8

                return false;↵

7

       ↵

9

            }↵

8

            }↵

10

            WaterfallBarRenderer that = (WaterfallBarRenderer) obj;↵

9

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

11

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

10

                return false;   ↵

12

                return false;↵

11

            }↵

13

            }↵

12

            BlockContainer that = (BlockContainer) obj↵

14

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

13

    ;↵

15

                return false;↵

14

      ↵

16

            }↵

15

          if (!this.arrangement.equals(that.arrangeme↵

17

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

16

    nt)) {↵

18

                    that.positiveBarPaint)) {↵

17

                return false;   ↵

19

                return false;↵

18

            }↵

20

            }↵

19

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

21

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

20

    )) {↵

22

                    that.negativeBarPaint)) {↵

21

                return false;   ↵

23

                return false;↵

22

            }↵

24

            }↵

23

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

1. {Non-refactorable}

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

   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 BlockContainer))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.BlockContainer | org.jfree.chart.renderer.category.WaterfallBarRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   5

       if (!(obj instanceof WaterfallBarRenderer))

   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;

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