296-1-4

if (obj == this) { return true; } if (!(obj instanceof CategoryLineAnnotation)) { return false; } CategoryLineAnnotation that = (CategoryLineAnnotation) obj; if (!this.category1.equals(that.getCategory1())) { return false; } if (this.value1 != that.getValue1()) { return false; } if (!this.category2.equals(that.getCategory2())) { return false; } if (this.value2 != that.getValue2()) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof DialTextAnnotation)) { return false; } DialTextAnnotation that = (DialTextAnnotation) obj; if (!this.label.equals(that.label)) { return false; } if (!this.font.equals(that.font)) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (this.radius != that.radius) { return false; } if (this.angle != that.angle) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } return super.equals(obj);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/CategoryLineAnnotation.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialTextAnnotation.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 18 |  | Number of AST nodes: 18

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof CategoryLineAnnotation)) {↵

4

            if (!(obj instanceof DialTextAnnotation)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            CategoryLineAnnotation that = (CategoryLineAnnotation) obj;↵

7

            DialTextAnnotation that = (DialTextAnnotation) obj;↵

8

            if (!this.category1.equals(that.getCategory1())) {↵

8

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

9

                return false;↵

9

                return false;↵

10

            }↵

10

            }↵

11

            if (this.value1 != that.getValue1()) {↵

11

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

12

                return false;↵

12

                return false;↵

13

            }↵

13

            }↵

14

            if (!this.category2.equals(that.getCategory2())) {↵

14

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

15

                return false;↵

15

                return false;↵

16

            }↵

16

            }↵

17

            if (this.value2 != that.getValue2()) {↵

17

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

18

                return false;↵

18

                return false;↵

19

            }↵

19

            }↵

20

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

20

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

21

                return false;↵

21

                return false;↵

22

            }↵

22

            }↵

23

            if (!ObjectUtilities.equal(this.stroke, that.stroke)) {↵

23

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

24

                return false;↵

24

                return false;↵

25

            }↵

25

            }↵

26

            return true;

26

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

1. {Non-refactorable}

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

   3 | if (!(obj instanceof CategoryLineAnnotation))
   3 | if (!(obj instanceof DialTextAnnotation))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.CategoryLineAnnotation | org.jfree.chart.plot.dial.DialTextAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof DialTextAnnotation))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       DialTextAnnotation that = (DialTextAnnotation)obj;

   5

       CategoryLineAnnotation that = (CategoryLineAnnotation)obj;

   6

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

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   6

       if (!this.category1.equals(that.getCategory1()))

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   8

       if (this.value1 != that.getValue1())

   8 | if (this.value1 != that.getValue1())
   12 | if (this.radius != that.radius)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   value1 | radius | VARIABLE_NAME_MISMATCH
   that.getValue1() | that.radius | TYPE_COMPATIBLE_REPLACEMENT

   12

       if (this.radius != that.radius)

   9

       return false;

   9 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   10

       if (!this.category2.equals(that.getCategory2()))

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (this.value2 != that.getValue2())

   12 | if (this.value2 != that.getValue2())
   14 | if (this.angle != that.angle)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   value2 | angle | VARIABLE_NAME_MISMATCH
   that.getValue2() | that.angle | TYPE_COMPATIBLE_REPLACEMENT

   14

       if (this.angle != that.angle)

   13

       return false;

   13 | return false;
   15 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   15

       return false;

   14

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

   14 | if (! PaintUtilities.equal(this.paint, that.paint))
   10 | if (! PaintUtilities.equal(this.paint, that.paint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.annotations.CategoryLineAnnotation | org.jfree.chart.plot.dial.DialTextAnnotation | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.annotations.CategoryLineAnnotation of variable that does not match with type org.jfree.chart.plot.dial.DialTextAnnotation of variable that
   - Make classes org.jfree.chart.annotations.CategoryLineAnnotation and org.jfree.chart.plot.dial.DialTextAnnotation extend a common superclass

   10

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

   15

       return false;

   15 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   Precondition Violations (16)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof CategoryLineAnnotation does not match with type boolean of variable obj instanceof DialTextAnnotation
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Type org.jfree.chart.annotations.CategoryLineAnnotation of variable that does not match with type org.jfree.chart.plot.dial.DialTextAnnotation 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;
   15 | Conditional return false;
   16 | Conditional return false;