276-1-2

if (obj == this) { return true; } if (!(obj instanceof AbstractBlock)) { return false; } AbstractBlock that = (AbstractBlock) obj; if (!ObjectUtilities.equal(this.id, that.id)) { return false; } if (!this.frame.equals(that.frame)) { return false; } if (!this.bounds.equals(that.bounds)) { return false; } if (!this.margin.equals(that.margin)) { return false; } if (!this.padding.equals(that.padding)) { return false; } if (this.height != that.height) { return false; } if (this.width != that.width) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof AbstractXYItemLabelGenerator)) { return false; } AbstractXYItemLabelGenerator that = (AbstractXYItemLabelGenerator) obj; if (!this.formatString.equals(that.formatString)) { return false; } if (!ObjectUtilities.equal(this.xFormat, that.xFormat)) { return false; } if (!ObjectUtilities.equal(this.xDateFormat, that.xDateFormat)) { return false; } if (!ObjectUtilities.equal(this.yFormat, that.yFormat)) { return false; } if (!ObjectUtilities.equal(this.yDateFormat, that.yDateFormat)) { return false; } if (!this.nullYString.equals(that.nullYString)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/AbstractBlock.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/AbstractXYItemLabelGenerator.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 20 |  | Number of AST nodes: 18

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;   ↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof AbstractBlock)) {↵

4

            if (!(obj instanceof AbstractXYItemLabelGenerator)) {↵

5

                return false;   ↵

5

                return false;↵

6

            }↵

6

            }↵

7

            AbstractBlock that = (AbstractBlock) obj;↵

7

            AbstractXYItemLabelGenerator that = (AbstractXYItemLabelGenerator) obj;↵

8

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

8

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

9

                return false;↵

9

                return false;↵

10

            }↵

10

            }↵

11

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

11

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

12

                return false;   ↵

12

                return false;↵

13

            }↵

13

            }↵

14

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

14

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

15

                return false;   ↵

15

                return false;↵

16

            }↵

16

            }↵

17

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

17

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

18

                return false;   ↵

18

                return false;↵

19

            }↵

19

            }↵

20

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

20

            if (!ObjectUtilities.equal(th↵

21

                return false;   ↵

22

            }↵

23

            if (this.height != that.height) {↵

21

    is.yDateFormat, that.yDateFormat)) {↵

24

                return false;   ↵

22

                return false;↵

25

            }↵

23

            }↵

26

            if (this.width != that.width) {↵

24

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

27

                return false;   ↵

25

            	return false;↵

28

            }↵

26

            }↵

29

            return true;

27

            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) | 3.9
Clones location | Clones are in different classes
Number of node comparisons | 118

1. {Non-refactorable}

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

   3 | if (!(obj instanceof AbstractBlock))
   3 | if (!(obj instanceof AbstractXYItemLabelGenerator))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.AbstractBlock | org.jfree.chart.labels.AbstractXYItemLabelGenerator | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof AbstractXYItemLabelGenerator))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       AbstractXYItemLabelGenerator that = (AbstractXYItemLabelGenerator)obj;

   5

       AbstractBlock that = (AbstractBlock)obj;

   6

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

   6 | if (! ObjectUtilities.equal(this.id, that.id))
   8 | if (! ObjectUtilities.equal(this.xFormat, that.xFormat))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   id | xFormat | VARIABLE_NAME_MISMATCH
   java.lang.String | java.text.NumberFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.lang.String of variable this.id does not match with type java.text.NumberFormat of variable this.xFormat
   - Make classes java.lang.String and java.text.NumberFormat extend a common superclass

   8

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

   7

       return false;

   7 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   8

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

   8 | if (! this.frame.equals(that.frame))
   6 | if (! this.formatString.equals(that.formatString))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.AbstractBlock | org.jfree.chart.labels.AbstractXYItemLabelGenerator | VARIABLE_TYPE_MISMATCH
   frame | formatString | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.BlockFrame | java.lang.String | VARIABLE_TYPE_MISMATCH
   frame | formatString | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.BlockFrame | java.lang.String | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.block.AbstractBlock of variable that does not match with type org.jfree.chart.labels.AbstractXYItemLabelGenerator of variable that
   - Make classes org.jfree.chart.block.AbstractBlock and org.jfree.chart.labels.AbstractXYItemLabelGenerator extend a common superclass

   Type org.jfree.chart.block.BlockFrame of variable that.frame does not match with type java.lang.String of variable that.formatString
   - Make classes org.jfree.chart.block.BlockFrame and java.lang.String extend a common superclass

   Type org.jfree.chart.block.BlockFrame of variable this.frame does not match with type java.lang.String of variable this.formatString
   - Make classes org.jfree.chart.block.BlockFrame and java.lang.String extend a common superclass

   6

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

   9

       return false;

   9 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

   10

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

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   12

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

   13 | return false;

   Preondition Violations
   Unmatched return false;

   13

       return false;

   14

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

   15 | return false;

   Preondition Violations
   Unmatched return false;

   15

       return false;

   10

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

   10 | if (! this.bounds.equals(that.bounds))
   16 | if (! this.nullYString.equals(that.nullYString))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.AbstractBlock | org.jfree.chart.labels.AbstractXYItemLabelGenerator | VARIABLE_TYPE_MISMATCH
   bounds | nullYString | VARIABLE_NAME_MISMATCH
   java.awt.geom.Rectangle2D | java.lang.String | VARIABLE_TYPE_MISMATCH
   bounds | nullYString | VARIABLE_NAME_MISMATCH
   java.awt.geom.Rectangle2D | java.lang.String | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.block.AbstractBlock of variable that does not match with type org.jfree.chart.labels.AbstractXYItemLabelGenerator of variable that
   - Make classes org.jfree.chart.block.AbstractBlock and org.jfree.chart.labels.AbstractXYItemLabelGenerator extend a common superclass

   Type java.awt.geom.Rectangle2D of variable that.bounds does not match with type java.lang.String of variable that.nullYString
   - Make classes java.awt.geom.Rectangle2D and java.lang.String extend a common superclass

   Type java.awt.geom.Rectangle2D of variable this.bounds does not match with type java.lang.String of variable this.nullYString
   - Make classes java.awt.geom.Rectangle2D and java.lang.String extend a common superclass

   16

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

   11

       return false;

   11 | return false;
   17 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   17

       return false;

   Precondition Violations (21)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof AbstractBlock does not match with type boolean of variable obj instanceof AbstractXYItemLabelGenerator
   2 | Type java.lang.String of variable this.id does not match with type java.text.NumberFormat of variable this.xFormat
   3 | Type org.jfree.chart.block.AbstractBlock of variable that does not match with type org.jfree.chart.labels.AbstractXYItemLabelGenerator of variable that
   4 | Type org.jfree.chart.block.BlockFrame of variable that.frame does not match with type java.lang.String of variable that.formatString
   5 | Type org.jfree.chart.block.BlockFrame of variable this.frame does not match with type java.lang.String of variable this.formatString
   6 | Unmatched return false;
   7 | Unmatched return false;
   8 | Unmatched return false;
   9 | Type org.jfree.chart.block.AbstractBlock of variable that does not match with type org.jfree.chart.labels.AbstractXYItemLabelGenerator of variable that
   10 | Type java.awt.geom.Rectangle2D of variable that.bounds does not match with type java.lang.String of variable that.nullYString
   11 | Type java.awt.geom.Rectangle2D of variable this.bounds does not match with type java.lang.String of variable this.nullYString
   12 | Conditional return true;
   13 | Conditional return true;
   14 | Conditional return false;
   15 | Conditional return false;
   16 | Conditional return false;
   17 | Conditional return false;
   18 | Conditional return false;
   19 | Conditional return false;
   20 | Conditional return false;
   21 | Conditional return false;