371-2-4

if (obj == this) { return true; } if (!(obj instanceof Title)) { return false; } if (!super.equals(obj)) { return false; } Title that = (Title) obj; if (this.position != that.position) { return false; } if (this.horizontalAlignment != that.horizontalAlignment) { return false; } if (this.verticalAlignment != that.verticalAlignment) { return false; } if (this.notify != that.notify) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof XYInterval)) { return false; } XYInterval that = (XYInterval) obj; if (this.xLow != that.xLow) { return false; } if (this.xHigh != that.xHigh) { return false; } if (this.y != that.y) { return false; } if (this.yLow != that.yLow) { return false; } if (this.yHigh != that.yHigh) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/title/Title.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/xy/XYInterval.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 16

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof Title)) {↵

4

            if (!(obj instanceof XYInterval)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            if (!super.equals(obj)↵

7

            XYInterval that = (XYInterval) obj;↵

8

    ) {↵

8

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

9

                return false;   ↵

9

                return false;↵

10

            }↵

10

            }↵

11

            Title that = (Title) obj;↵

12

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

11

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

13

                return false;↵

12

                return false;↵

14

            }↵

13

            }↵

15

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

14

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

16

                return false;↵

15

                return false;↵

17

            }↵

16

            }↵

18

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

17

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

19

                return false;↵

18

                return false;↵

20

            }↵

19

            }↵

21

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

20

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

22

                return false;↵

21

                return false;↵

23

            }↵

22

            }↵

24

            return true;

23

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

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 Title))

   3 | if (!(obj instanceof Title))
   3 | if (!(obj instanceof XYInterval))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.title.Title | org.jfree.data.xy.XYInterval | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof Title does not match with type boolean of variable obj instanceof XYInterval
   - Make classes org.jfree.chart.title.Title and org.jfree.data.xy.XYInterval extend a common superclass

   3

       if (!(obj instanceof XYInterval))

   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 Title does not match with type boolean of variable obj instanceof XYInterval
   2 | Conditional return true;
   3 | Conditional return true;
   4 | Conditional return false;
   5 | Conditional return false;