43-1-111

if (obj == this) { return true; } if (!(obj instanceof PieLabelRecord)) { return false; } PieLabelRecord that = (PieLabelRecord) obj; if (!this.key.equals(that.key)) { return false; } if (this.angle != that.angle) { return false; } if (this.gap != that.gap) { return false; } if (this.allocatedY != that.allocatedY) { return false; } if (this.baseY != that.baseY) { return false; } if (this.labelHeight != that.labelHeight) { return false; } if (this.linkPercent != that.linkPercent) { return false; } if (!this.label.equals(that.label)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof LegendItemCollection)) { return false; } LegendItemCollection that = (LegendItemCollection) obj; if (!this.items.equals(that.items)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PieLabelRecord.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/LegendItemCollection.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 22 |  | 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 PieLabelRecord)) {↵

4

            if (!(obj instanceof ↵

5

                return false;↵

6

            }↵

7

            PieLabelRecord that = (PieLabelRecord) obj;↵

8

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

9

                return false;↵

10

            }↵

11

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

12

                return false;↵

13

            }↵

14

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

15

                return false;↵

16

            }↵

17

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

18

                return false;↵

19

            }↵

20

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

21

                return false;↵

22

            }↵

23

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

24

                return false;↵

25

            }↵

26

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

27

                return false;↵

28

            }↵

5

    LegendItemCollection)) {↵

6

                return false;↵

7

            }↵

8

            LegendItemCollection that = (LegendItemCollection) obj;↵

29

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

9

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

30

                return false;↵

10

                return false;↵

31

            }↵

11

            }↵

32

            return true;

12

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

1. {Non-refactorable}

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

   3 | if (!(obj instanceof PieLabelRecord))
   3 | if (!(obj instanceof LegendItemCollection))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.PieLabelRecord | org.jfree.chart.LegendItemCollection | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof PieLabelRecord does not match with type boolean of variable obj instanceof LegendItemCollection
   - Make classes org.jfree.chart.plot.PieLabelRecord and org.jfree.chart.LegendItemCollection extend a common superclass

   3

       if (!(obj instanceof LegendItemCollection))

   4

       return false;

   4

       return false;

   5

       LegendItemCollection that = (LegendItemCollection)obj;

   5

       PieLabelRecord that = (PieLabelRecord)obj;

   6

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

   6 | if (! this.key.equals(that.key))
   6 | if (! this.items.equals(that.items))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.PieLabelRecord | org.jfree.chart.LegendItemCollection | VARIABLE_TYPE_MISMATCH
   key | items | VARIABLE_NAME_MISMATCH
   java.lang.Comparable | java.util.List | VARIABLE_TYPE_MISMATCH
   key | items | VARIABLE_NAME_MISMATCH
   java.lang.Comparable | java.util.List | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.PieLabelRecord of variable that does not match with type org.jfree.chart.LegendItemCollection of variable that
   - Make classes org.jfree.chart.plot.PieLabelRecord and org.jfree.chart.LegendItemCollection extend a common superclass

   Type java.lang.Comparable of variable that.key does not match with type java.util.List of variable that.items
   - Make classes java.lang.Comparable and java.util.List extend a common superclass

   Type java.lang.Comparable of variable this.key does not match with type java.util.List of variable this.items
   - Make classes java.lang.Comparable and java.util.List extend a common superclass

   6

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

   7

       return false;

   7

       return false;

   8

       if (this.angle != that.angle)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.gap != that.gap)

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (this.allocatedY != that.allocatedY)

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

       if (this.baseY != that.baseY)

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       if (this.labelHeight != that.labelHeight)

   17

       return false;

   17 | return false;

   Preondition Violations
   Unmatched return false;

   18

       if (this.linkPercent != that.linkPercent)

   19

       return false;

   19 | return false;

   Preondition Violations
   Unmatched return false;

   20

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

   21

       return false;

   21 | return false;

   Preondition Violations
   Unmatched return false;

   22

       return true;

   8

       return true;

   Precondition Violations (11)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof PieLabelRecord does not match with type boolean of variable obj instanceof LegendItemCollection
   2 | Type org.jfree.chart.plot.PieLabelRecord of variable that does not match with type org.jfree.chart.LegendItemCollection of variable that
   3 | Type java.lang.Comparable of variable that.key does not match with type java.util.List of variable that.items
   4 | Type java.lang.Comparable of variable this.key does not match with type java.util.List of variable this.items
   5 | Unmatched return false;
   6 | Unmatched return false;
   7 | Unmatched return false;
   8 | Unmatched return false;
   9 | Unmatched return false;
   10 | Unmatched return false;
   11 | Unmatched return false;