43-1-108

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 == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof HistogramType)) { return false; } HistogramType t = (HistogramType) obj; if (!this.name.equals(t.name)) { 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/data/statistics/HistogramType.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 22 |  | Number of AST nodes: 10

1

    if (obj == this) {↵

1

    if (obj == ↵

2

                return true;↵

3

            }↵

4

            if (!(obj instanceof PieLabelRecord)) {↵

2

    null) {↵

5

                return false;↵

3

                return false;   ↵

6

            }↵

4

            }↵

7

            PieLabelRecord that = (PieLabelRecord) obj;↵

5

            ↵

8

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

9

    ) {↵

6

            if (obj == this) {↵

10

                return false;↵

7

                return true;↵

11

            }↵

8

            }↵

12

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

9

            ↵

13

                return false;↵

14

            }↵

15

            if (this.gap != that.gap↵

16

    ) {↵

10

            if (!(obj instanceof HistogramType)) {↵

17

                return false;↵

11

                return false;↵

18

            }↵

12

            }↵

19

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

13

            ↵

20

                return false;↵

21

            }↵

22

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

23

                return false;↵

24

            }↵

14

            HistogramType t = (HistogramType) obj;↵

25

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

15

            if (!this.↵

26

                return false;↵

27

            }↵

28

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

29

                return false;↵

30

            }↵

31

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

32

                return false;↵

33

            }↵

16

    name.equals(t.name)) {↵

17

                return false;↵

18

            }↵

19

            ↵

34

            return true;

20

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

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 | 1
   Time elapsed for statement mapping (ms) | 0.9
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (obj == this)

   3

       if (obj == this)

   2

       return true;

   2 | return true;
   4 | return true;

   Preondition Violations
   Conditional return true;
   Conditional return true;

   4

       return true;

   3

       if (!(obj instanceof PieLabelRecord))

   3 | if (!(obj instanceof PieLabelRecord))
   5 | if (!(obj instanceof HistogramType))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.PieLabelRecord | org.jfree.data.statistics.HistogramType | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   5

       if (!(obj instanceof HistogramType))

   4

       return false;

   4 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   5

       PieLabelRecord that = (PieLabelRecord)obj;

   7

       HistogramType t = (HistogramType)obj;

   6

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

   6 | if (! this.key.equals(that.key))
   8 | if (! this.name.equals(t.name))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   that | t | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.PieLabelRecord | org.jfree.data.statistics.HistogramType | VARIABLE_TYPE_MISMATCH
   key | name | VARIABLE_NAME_MISMATCH
   java.lang.Comparable | java.lang.String | VARIABLE_TYPE_MISMATCH
   key | name | VARIABLE_NAME_MISMATCH
   java.lang.Comparable | java.lang.String | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type java.lang.Comparable of variable that.key does not match with type java.lang.String of variable t.name
   - Make classes java.lang.Comparable and java.lang.String extend a common superclass

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

   8

       if (!this.name.equals(t.name))

   7

       return false;

   7 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (10)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof PieLabelRecord does not match with type boolean of variable obj instanceof HistogramType
   2 | Type org.jfree.chart.plot.PieLabelRecord of variable that does not match with type org.jfree.data.statistics.HistogramType of variable t
   3 | Type java.lang.Comparable of variable that.key does not match with type java.lang.String of variable t.name
   4 | Type java.lang.Comparable of variable this.key does not match with type java.lang.String of variable this.name
   5 | Conditional return true;
   6 | Conditional return true;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;