43-1-66

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 MinMaxCategoryRenderer)) { return false; } MinMaxCategoryRenderer that = (MinMaxCategoryRenderer) obj; if (this.plotLines != that.plotLines) { return false; } if (!PaintUtilities.equal(this.groupPaint, that.groupPaint)) { return false; } if (!this.groupStroke.equals(that.groupStroke)) { 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/MinMaxCategoryRenderer.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 MinMaxCategoryRenderer)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            PieLabelRecord that = (PieLabelRecord) obj;↵

7

            MinMaxCategoryRenderer that = (MinMaxCategoryRenderer) obj;↵

8

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

8

            if (this.↵

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↵

9

    plotLines != that.plotLines) {↵

10

                return false;↵

11

            }↵

27

    ) {↵

12

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

28

                return false;↵

13

                return false;↵

29

            }↵

14

            }↵

30

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

15

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

31

                return false;↵

16

                return false;↵

32

            }↵

17

            }↵

33

            return true;

18

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

1. {Non-refactorable}

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

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

   Preondition Violations

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

   3

       if (!(obj instanceof MinMaxCategoryRenderer))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       MinMaxCategoryRenderer that = (MinMaxCategoryRenderer)obj;

   5

       PieLabelRecord that = (PieLabelRecord)obj;

   6

       if (this.plotLines != that.plotLines)

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   6

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

   6 | if (! this.key.equals(that.key))
   10 | if (! this.groupStroke.equals(that.groupStroke))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.PieLabelRecord | org.jfree.chart.renderer.category.MinMaxCategoryRenderer | VARIABLE_TYPE_MISMATCH
   key | groupStroke | VARIABLE_NAME_MISMATCH
   java.lang.Comparable | java.awt.Stroke | VARIABLE_TYPE_MISMATCH
   key | groupStroke | VARIABLE_NAME_MISMATCH
   java.lang.Comparable | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type java.lang.Comparable of variable that.key does not match with type java.awt.Stroke of variable that.groupStroke
   - Make classes java.lang.Comparable and java.awt.Stroke extend a common superclass

   Type java.lang.Comparable of variable this.key does not match with type java.awt.Stroke of variable this.groupStroke
   - Make classes java.lang.Comparable and java.awt.Stroke extend a common superclass

   10

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

   7

       return false;

   7 | 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 PieLabelRecord does not match with type boolean of variable obj instanceof MinMaxCategoryRenderer
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Type org.jfree.chart.plot.PieLabelRecord of variable that does not match with type org.jfree.chart.renderer.category.MinMaxCategoryRenderer of variable that
   5 | Type java.lang.Comparable of variable that.key does not match with type java.awt.Stroke of variable that.groupStroke
   6 | Type java.lang.Comparable of variable this.key does not match with type java.awt.Stroke of variable this.groupStroke
   7 | Conditional return true;
   8 | Conditional return true;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;