43-12-144

if (obj == this) { return true; } if (!(obj instanceof OHLCDataItem)) { return false; } OHLCDataItem that = (OHLCDataItem) obj; if (!this.date.equals(that.date)) { return false; } if (!this.high.equals(that.high)) { return false; } if (!this.low.equals(that.low)) { return false; } if (!this.open.equals(that.open)) { return false; } if (!this.close.equals(that.close)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof MonthDateFormat)) { return false; } if (!super.equals(obj)) { return false; } MonthDateFormat that = (MonthDateFormat) obj; if (!Arrays.equals(this.months, that.months)) { return false; } if (!Arrays.equals(this.showYear, that.showYear)) { return false; } if (!this.yearFormatter.equals(that.yearFormatter)) { return false; } return true;

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

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;   ↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof OHLCDataItem)) {↵

4

            if (!(obj instanceof MonthDateFormat)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            OHLCDataItem that = (OHLCDataItem) obj;↵

7

            ↵

8

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

8

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

9

                return false;   ↵

9

                return false;↵

10

            }↵

10

            }↵

11

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

11

            ↵

12

                return false;↵

13

            }↵

14

            if (!this.low.equals(that.low↵

12

    MonthDateFormat that = (MonthDateFormat) obj;↵

15

    )) {↵

13

            if (!Arrays.equals(this.months, that.months)) {↵

16

                return false;   ↵

14

                return false;↵

17

            }↵

15

            }↵

18

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

16

            if (!Arrays.equals(this.showYear, that.showYear)) {↵

19

                return false;   ↵

17

                return false;↵

20

            }↵

18

            }↵

21

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

19

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

22

                return false;   ↵

20

                return false;↵

23

            }↵

21

            }↵

24

            return true;

22

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   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 OHLCDataItem))

   3 | if (!(obj instanceof OHLCDataItem))
   3 | if (!(obj instanceof MonthDateFormat))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.axis.MonthDateFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof MonthDateFormat))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       OHLCDataItem that = (OHLCDataItem)obj;

   6

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

   6 | if (! this.date.equals(that.date))
   5 | if (! super.equals(obj))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this.date.equals(that.date) | super.equals(obj) | TYPE_COMPATIBLE_REPLACEMENT

   5

       if (!super.equals(obj))

   7

       return false;

   7 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   7

       MonthDateFormat that = (MonthDateFormat)obj;

   8

       if (!Arrays.equals(this.months, that.months))

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   10

       if (!Arrays.equals(this.showYear, that.showYear))

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   8

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

   8 | if (! this.high.equals(that.high))
   12 | if (! this.yearFormatter.equals(that.yearFormatter))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.axis.MonthDateFormat | VARIABLE_TYPE_MISMATCH
   high | yearFormatter | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.text.DateFormat | VARIABLE_TYPE_MISMATCH
   high | yearFormatter | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.text.DateFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.axis.MonthDateFormat of variable that
   - Make classes org.jfree.data.xy.OHLCDataItem and org.jfree.chart.axis.MonthDateFormat extend a common superclass

   Type java.lang.Number of variable that.high does not match with type java.text.DateFormat of variable that.yearFormatter
   - Make classes java.lang.Number and java.text.DateFormat extend a common superclass

   Type java.lang.Number of variable this.high does not match with type java.text.DateFormat of variable this.yearFormatter
   - Make classes java.lang.Number and java.text.DateFormat extend a common superclass

   12

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

   9

       return false;

   9 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   Precondition Violations (14)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof OHLCDataItem does not match with type boolean of variable obj instanceof MonthDateFormat
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.axis.MonthDateFormat of variable that
   5 | Type java.lang.Number of variable that.high does not match with type java.text.DateFormat of variable that.yearFormatter
   6 | Type java.lang.Number of variable this.high does not match with type java.text.DateFormat of variable this.yearFormatter
   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;