43-14-65

if (obj == this) { return true; } if (!(obj instanceof BorderArrangement)) { return false; } BorderArrangement that = (BorderArrangement) obj; if (!ObjectUtilities.equal(this.topBlock, that.topBlock)) { return false; } if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock)) { return false; } if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock)) { return false; } if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock)) { return false; } if (!ObjectUtilities.equal(this.centerBlock, that.centerBlock)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof LineBorder)) { return false; } LineBorder that = (LineBorder) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!this.insets.equals(that.insets)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/BorderArrangement.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/block/LineBorder.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 12

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;   ↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof BorderArrangement)) {↵

4

            if (!(obj instanceof LineBorder)) {↵

5

                return false;↵

5

                return false;   ↵

6

            }↵

6

            }↵

7

            BorderArrangement that = (BorderArrangement) obj;↵

7

            LineBorder that = (LineBorder) obj;↵

8

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

8

            if (!PaintUtilities.equal(this.↵

9

                return false;↵

10

            }↵

11

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

9

    paint, that.paint)) {↵

12

                return false;↵

10

                return false;↵

13

            }↵

11

            }↵

14

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

12

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

15

                return false;↵

13

                return false;↵

16

            }↵

14

            }↵

17

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

15

            if (!↵

18

                return false;↵

19

            }↵

20

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

16

    this.insets.equals(that.insets)) {↵

21

                return false;↵

17

                return false;↵

22

            }↵

18

            }↵

23

            return true;

19

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

1. {Non-refactorable}

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

   3 | if (!(obj instanceof BorderArrangement))
   3 | if (!(obj instanceof LineBorder))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.BorderArrangement | org.jfree.chart.block.LineBorder | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof LineBorder))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       LineBorder that = (LineBorder)obj;

   5

       BorderArrangement that = (BorderArrangement)obj;

   6

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

   6 | if (! ObjectUtilities.equal(this.topBlock, that.topBlock))
   6 | if (! PaintUtilities.equal(this.paint, that.paint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   topBlock | paint | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.Block | java.awt.Paint | VARIABLE_TYPE_MISMATCH
   org.jfree.util.ObjectUtilities | org.jfree.util.PaintUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.block.Block of variable this.topBlock does not match with type java.awt.Paint of variable this.paint
   - Make classes org.jfree.chart.block.Block and java.awt.Paint extend a common superclass

   Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   - Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass

   6

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

   7

       return false;

   7 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

   8

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

   8 | if (! ObjectUtilities.equal(this.bottomBlock, that.bottomBlock))
   8 | if (! ObjectUtilities.equal(this.stroke, that.stroke))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   bottomBlock | stroke | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.Block | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.block.Block of variable this.bottomBlock does not match with type java.awt.Stroke of variable this.stroke
   - Make classes org.jfree.chart.block.Block and java.awt.Stroke extend a common superclass

   8

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

   9

       return false;

   9 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof BorderArrangement does not match with type boolean of variable obj instanceof LineBorder
   2 | Type org.jfree.chart.block.Block of variable this.topBlock does not match with type java.awt.Paint of variable this.paint
   3 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   4 | Type org.jfree.chart.block.Block of variable this.bottomBlock does not match with type java.awt.Stroke of variable this.stroke
   5 | Conditional return true;
   6 | Conditional return true;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;