43-115-126

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 YIntervalRenderer)) { return false; } YIntervalRenderer that = (YIntervalRenderer) obj; if (!ObjectUtilities.equal(this.additionalItemLabelGenerator, that.additionalItemLabelGenerator)) { 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/renderer/xy/YIntervalRenderer.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 ↵

5

                return false;   ↵

6

            }↵

7

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

5

    YIntervalRenderer)) {↵

8

                return false;   ↵

6

        		return false;↵

9

            }↵

7

        	}↵

10

            BlockContainer that = (BlockContainer) obj;↵

8

        	YIntervalRenderer that = (YIntervalRenderer) obj;↵

11

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

9

        	if (!ObjectUtilities.equal(th↵

12

                return false;   ↵

13

            }↵

14

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

10

    is.additionalItemLabelGenerator,↵

15

    )) {↵

11

        			that.additionalItemLabelGenerator)) {↵

16

                return false;   ↵

12

        		return false;↵

17

            }↵

13

        	}↵

18

            return true;

14

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

1. {Non-refactorable}

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.BlockContainer | org.jfree.chart.renderer.xy.YIntervalRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof YIntervalRenderer))

   4

       return false;

   4

       return false;

   5

       YIntervalRenderer that = (YIntervalRenderer)obj;

   5

       if (!super.equals(obj))

   5 | if (! super.equals(obj))
   6 | if (! ObjectUtilities.equal(this.additionalItemLabelGenerator, that.additionalItemLabelGenerator))

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

   6

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

   6

       return false;

   7

       return false;

   7

       BlockContainer that = (BlockContainer)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 (3)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof BlockContainer does not match with type boolean of variable obj instanceof YIntervalRenderer
   2 | Unmatched return false;
   3 | Unmatched return false;