43-115-133

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 (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj);

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/block/ColorBlock.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 12 |  | Number of AST nodes: 8

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;   ↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof BlockContainer)) {↵

4

            if (!(obj instanceof ColorBlock)) {↵

5

                return false;   ↵

5

                return false;↵

6

            }↵

6

            }↵

7

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

7

            ↵

8

                return false;   ↵

9

            }↵

10

            BlockContainer that = (BlockContainer) obj;↵

8

    ColorBlock that = (ColorBlock) obj;↵

11

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

9

            if (!PaintUtilities.equal(th↵

12

                return false;   ↵

13

            }↵

14

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

10

    is.paint, that.paint)) {↵

15

                return false;   ↵

11

                return false;↵

16

            }↵

12

            }↵

17

            return true;

13

            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) | 0.7
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 37

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 4
   Number of unmapped statements in the second code fragment | 0
   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 BlockContainer))

   3 | if (!(obj instanceof BlockContainer))
   3 | if (!(obj instanceof ColorBlock))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.BlockContainer | org.jfree.chart.block.ColorBlock | SUBCLASS_TYPE_MISMATCH

   3

       if (!(obj instanceof ColorBlock))

   4

       return false;

   4

       return false;

   5

       if (!super.equals(obj))

   5 | if (! super.equals(obj))
   6 | if (! PaintUtilities.equal(this.paint, that.paint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   super.equals(obj) | PaintUtilities.equal(this.paint,that.paint) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression PaintUtilities.equal(this.paint,that.paint) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

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

   6

       return false;

   7

       return false;

   7

       BlockContainer that = (BlockContainer)obj;

   7 | BlockContainer that = (BlockContainer)obj;
   5 | ColorBlock that = (ColorBlock)obj;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.BlockContainer | org.jfree.chart.block.ColorBlock | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.block.BlockContainer | org.jfree.chart.block.ColorBlock | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.block.BlockContainer | org.jfree.chart.block.ColorBlock | SUBCLASS_TYPE_MISMATCH

   5

       ColorBlock that = (ColorBlock)obj;

   8

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

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

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

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       return true;

   12 | return true;
   8 | return super.equals(obj);

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

   8

       return super.equals(obj);

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Expression PaintUtilities.equal(this.paint,that.paint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Clone fragment #1 returns variables that , while Clone fragment #2 returns variables