43-1-59

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 StandardCategoryURLGenerator)) { return false; } StandardCategoryURLGenerator that = (StandardCategoryURLGenerator) obj; if (!ObjectUtilities.equal(this.prefix, that.prefix)) { return false; } if (!ObjectUtilities.equal(this.seriesParameterName, that.seriesParameterName)) { return false; } if (!ObjectUtilities.equal(this.categoryParameterName, that.categoryParameterName)) { 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/urls/StandardCategoryURLGenerator.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 22 |  | 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 PieLabelRecord)) {↵

4

            if (!(obj instanceof StandardCategoryURLGenerator)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            PieLabelRecord that = (PieLabelRecord) obj;↵

7

            StandardCategoryURLGenerator that = (StandardCategoryURLGenerator) obj;↵

8

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

8

            if (!ObjectUtilities.equal(th↵

9

                return false;↵

10

            }↵

11

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

9

    is.prefix, that.prefix)) {↵

12

                return false;↵

10

                return false;↵

13

            }↵

11

            }↵

14

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

12

            if (↵

15

                return false;↵

16

            }↵

17

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

18

                return false;↵

13

    !ObjectUtilities.equal(this.seriesParameterName,↵

19

            }↵

14

            ↵

20

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

15

            that.seriesParameterName)) {↵

21

                return false;↵

16

                return false;↵

22

            }↵

17

            }↵

23

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

18

            if (↵

24

                return false;↵

25

            }↵

26

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

27

                return false;↵

19

    !ObjectUtilities.equal(this.categoryParameterName,↵

28

            }↵

20

            ↵

29

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

21

            that.categoryParameterName)) {↵

30

                return false;↵

22

                return false;↵

31

            }↵

23

            }↵

32

            return true;

24

            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 | 59

1. {Non-refactorable}

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

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

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

   Preondition Violations

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

   3

       if (!(obj instanceof StandardCategoryURLGenerator))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof PieLabelRecord does not match with type boolean of variable obj instanceof StandardCategoryURLGenerator
   2 | Conditional return true;
   3 | Conditional return true;
   4 | Conditional return false;
   5 | Conditional return false;