43-1-50

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 GanttRenderer)) { return false; } GanttRenderer that = (GanttRenderer) obj; if (!PaintUtilities.equal(this.completePaint, that.completePaint)) { return false; } if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint)) { return false; } if (this.startPercent != that.startPercent) { return false; } if (this.endPercent != that.endPercent) { return false; } return super.equals(obj);

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/renderer/category/GanttRenderer.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 22 |  | Number of AST nodes: 14

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

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            PieLabelRecord that = (PieLabelRecord) obj;↵

7

            GanttRenderer that = (GanttRenderer) obj;↵

8

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

8

            if (!PaintUtilities.equal(th↵

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.labelHeigh↵

9

    is.completePaint, that.completePaint)) {↵

10

                return false;↵

11

            }↵

12

            if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint)) {↵

13

                return false;↵

14

            }↵

24

    t) {↵

15

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

25

                return false;↵

16

                return false;↵

26

            }↵

17

            }↵

27

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

18

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

28

                return false;↵

19

                return false;↵

29

            }↵

20

            }↵

30

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

21

            ↵

31

                return false;↵

32

            }↵

33

            return true;

22

    return super.equals(obj);

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

1. {Non-refactorable}

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

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.PieLabelRecord | org.jfree.chart.renderer.category.GanttRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof GanttRenderer))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       GanttRenderer that = (GanttRenderer)obj;

   5

       PieLabelRecord that = (PieLabelRecord)obj;

   6

       if (!PaintUtilities.equal(this.completePaint, that.completePaint))

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   6

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

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

       if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint))

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   8

       if (this.angle != that.angle)

   8 | if (this.angle != that.angle)
   10 | if (this.startPercent != that.startPercent)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   angle | startPercent | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.PieLabelRecord | org.jfree.chart.renderer.category.GanttRenderer | VARIABLE_TYPE_MISMATCH
   angle | startPercent | VARIABLE_NAME_MISMATCH

   Preondition Violations

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

   10

       if (this.startPercent != that.startPercent)

   9

       return false;

   9 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   10

       if (this.gap != that.gap)

   10 | if (this.gap != that.gap)
   12 | if (this.endPercent != that.endPercent)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   gap | endPercent | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.PieLabelRecord | org.jfree.chart.renderer.category.GanttRenderer | VARIABLE_TYPE_MISMATCH
   gap | endPercent | VARIABLE_NAME_MISMATCH

   Preondition Violations

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

   12

       if (this.endPercent != that.endPercent)

   11

       return false;

   11 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   Precondition Violations (14)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof PieLabelRecord does not match with type boolean of variable obj instanceof GanttRenderer
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Type org.jfree.chart.plot.PieLabelRecord of variable that does not match with type org.jfree.chart.renderer.category.GanttRenderer of variable that
   6 | Type org.jfree.chart.plot.PieLabelRecord of variable that does not match with type org.jfree.chart.renderer.category.GanttRenderer of variable that
   7 | Conditional return true;
   8 | Conditional return true;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;
   14 | Conditional return false;