43-14-64

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 AbstractCategoryItemLabelGenerator)) { return false; } AbstractCategoryItemLabelGenerator that = (AbstractCategoryItemLabelGenerator) obj; if (!this.labelFormat.equals(that.labelFormat)) { return false; } if (!ObjectUtilities.equal(this.dateFormat, that.dateFormat)) { return false; } if (!ObjectUtilities.equal(this.numberFormat, that.numberFormat)) { 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/labels/AbstractCategoryItemLabelGenerator.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 AbstractCategoryItemLabelGenerator)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            BorderArrangement that = (BorderArrangement) obj;↵

7

            ↵

8

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

9

                return false;↵

10

            }↵

11

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

12

                return false;↵

13

            }↵

14

            if (!ObjectUtilities↵

8

            AbstractCategoryItemLabelGenerator that ↵

9

                = (AbstractCategoryItemLabelGenerator) obj;↵

15

    .equal(this.leftBlock, that.leftBlock)) {↵

10

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

16

                return false;↵

11

                return false;↵

17

            }↵

12

            }↵

18

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

13

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

19

                return false;↵

14

                return false;↵

20

            }↵

15

            }↵

21

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

16

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

22

                return false;↵

17

                return false;↵

23

            }↵

18

            }↵

24

            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 | 3
   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;
   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 AbstractCategoryItemLabelGenerator))

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

   Preondition Violations

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

   3

       if (!(obj instanceof AbstractCategoryItemLabelGenerator))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       AbstractCategoryItemLabelGenerator that = (AbstractCategoryItemLabelGenerator)obj;

   5

       BorderArrangement that = (BorderArrangement)obj;

   6

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

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   6

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   topBlock | dateFormat | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.Block | java.text.DateFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   8

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

   7

       return false;

   7 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   8

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   bottomBlock | numberFormat | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.Block | java.text.NumberFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   10

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

   9

       return false;

   9 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       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 AbstractCategoryItemLabelGenerator
   2 | Unmatched return false;
   3 | Type org.jfree.chart.block.Block of variable this.topBlock does not match with type java.text.DateFormat of variable this.dateFormat
   4 | Type org.jfree.chart.block.Block of variable this.bottomBlock does not match with type java.text.NumberFormat of variable this.numberFormat
   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;