43-14-82

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 MeanAndStandardDeviation)) { return false; } MeanAndStandardDeviation that = (MeanAndStandardDeviation) obj; if (!ObjectUtilities.equal(this.mean, that.mean)) { return false; } if (!ObjectUtilities.equal( this.standardDeviation, that.standardDeviation) ) { 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/data/statistics/MeanAndStandardDeviation.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 10

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 MeanAndStandardDeviation)) {↵

5

                return false;↵

5

                return false;   ↵

6

            }↵

6

            }↵

7

            BorderArrangement that = (BorderArrangement) obj;↵

7

            MeanAndStandardDeviation that = (MeanAndStandardDeviation) obj;↵

8

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

8

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

9

                return false;↵

9

                return false;   ↵

10

            }↵

10

            }↵

11

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

11

            if (!ObjectUtilities.equal(↵

12

                return false;↵

13

            }↵

14

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

15

                return false;↵

16

            }↵

17

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

18

                return false;↵

19

            }↵

20

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

12

                this.standardDeviation, that.standardDeviation)↵

21

    ) {↵

13

            ) {↵

22

                return false;↵

14

                return false;   ↵

23

            }↵

15

            }↵

24

            return true;

16

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

1. {Non-refactorable}

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.BorderArrangement | org.jfree.data.statistics.MeanAndStandardDeviation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof MeanAndStandardDeviation))

   4

       return false;

   4

       return false;

   5

       MeanAndStandardDeviation that = (MeanAndStandardDeviation)obj;

   5

       BorderArrangement that = (BorderArrangement)obj;

   6

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   topBlock | mean | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.Block | java.lang.Number | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   6

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

   7

       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.standardDeviation, that.standardDeviation))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   bottomBlock | standardDeviation | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.Block | java.lang.Number | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   8

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

   9

       return false;

   9

       return false;

   10

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

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

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

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

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

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       return true;

   10

       return true;

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof BorderArrangement does not match with type boolean of variable obj instanceof MeanAndStandardDeviation
   2 | Type org.jfree.chart.block.Block of variable this.topBlock does not match with type java.lang.Number of variable this.mean
   3 | Type org.jfree.chart.block.Block of variable this.bottomBlock does not match with type java.lang.Number of variable this.standardDeviation
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Unmatched return false;