43-108-149

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;
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;

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

1

    if (obj == null) {↵

1

    if (obj == this) {↵

2

                return false;   ↵

2

                return ↵

3

            }↵

4

            ↵

5

            if (obj == this↵

3

    true;↵

4

            }↵

5

            if (!(obj instanceof Title)) {↵

6

                return false;↵

7

            }↵

6

    ) {↵

8

            if (!super.equals(obj)) {↵

7

                return true;↵

9

                return false;   ↵

8

            }↵

10

            }↵

9

            ↵

11

            ↵

10

            if (!(obj instanceof HistogramType)↵

12

    Title that = (Title) obj;↵

11

    ) {↵

13

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

12

                return false;↵

14

                return false;↵

13

            }↵

15

            }↵

14

            ↵

16

            ↵

15

            HistogramType t = (HistogramType) obj;↵

17

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

18

                return false;↵

19

            }↵

16

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

20

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

17

                return false;↵

21

                return false;↵

18

            }↵

22

            }↵

19

            ↵

23

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

24

                return false;↵

25

            }↵

20

            return true;

26

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 0.7
   Clone type | Type 3

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

   1

       if (obj == null)

   1 | if (obj == null)
   1 | if (obj == this)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   null | this | TYPE_COMPATIBLE_REPLACEMENT

   1

       if (obj == this)

   2

       return false;

   2 | return false;
   2 | return true;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   false | true | LITERAL_VALUE_MISMATCH

   Preondition Violations
   Conditional return false;
   Conditional return true;

   2

       return true;

   3

       if (obj == this)

   4

       return true;

   4 | return true;

   Preondition Violations
   Unmatched return true;

   5

       if (!(obj instanceof HistogramType))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.statistics.HistogramType | org.jfree.chart.title.Title | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof Title))

   6

       return false;

   6 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   7

       HistogramType t = (HistogramType)obj;

   8

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

   8 | if (! this.name.equals(t.name))
   5 | if (! super.equals(obj))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this.name.equals(t.name) | super.equals(obj) | TYPE_COMPATIBLE_REPLACEMENT

   5

       if (!super.equals(obj))

   9

       return false;

   9 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Unmatched return true;
   2 | Type boolean of variable obj instanceof HistogramType does not match with type boolean of variable obj instanceof Title
   3 | Conditional return false;
   4 | Conditional return true;
   5 | Conditional return false;
   6 | Conditional return false;
   7 | Conditional return false;
   8 | Conditional return false;