43-12-58

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 AbstractPieItemLabelGenerator)) { return false; } AbstractPieItemLabelGenerator that = (AbstractPieItemLabelGenerator) obj; if (!this.labelFormat.equals(that.labelFormat)) { return false; } if (!this.numberFormat.equals(that.numberFormat)) { return false; } if (!this.percentFormat.equals(that.percentFormat)) { 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/labels/AbstractPieItemLabelGenerator.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 12

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 AbstractPieItemLabelGenerator)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            OHLCDataItem that = (OHLCDataItem) obj;↵

7

            ↵

8

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

9

                return false;   ↵

8

    AbstractPieItemLabelGenerator that↵

10

            }↵

9

            ↵

11

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

10

            ↵

12

                return false;↵

13

            }↵

11

    = (AbstractPieItemLabelGenerator) obj;↵

14

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

12

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

15

                return false;   ↵

13

                return false;↵

16

            }↵

14

            }↵

17

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

15

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

18

                return false;   ↵

16

                return false;↵

19

            }↵

17

            }↵

20

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

18

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

21

                return false;   ↵

19

                return false;↵

22

            }↵

20

            }↵

23

            return true;

21

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 11
   Number of unmapped statements in the first code fragment | 5
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 1.2
   Clone type | Type 3

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

   1

       if (obj == this)

   1

       if (obj == this)

   2

       return true;

   2

       return true;

   3

       if (!(obj instanceof OHLCDataItem))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.labels.AbstractPieItemLabelGenerator | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof AbstractPieItemLabelGenerator))

   4

       return false;

   4

       return false;

   5

       AbstractPieItemLabelGenerator that = (AbstractPieItemLabelGenerator)obj;

   5

       OHLCDataItem that = (OHLCDataItem)obj;

   6

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

   6 | if (! this.date.equals(that.date))
   6 | if (! this.labelFormat.equals(that.labelFormat))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.labels.AbstractPieItemLabelGenerator | VARIABLE_TYPE_MISMATCH
   date | labelFormat | VARIABLE_NAME_MISMATCH
   java.util.Date | java.lang.String | VARIABLE_TYPE_MISMATCH
   date | labelFormat | VARIABLE_NAME_MISMATCH
   java.util.Date | java.lang.String | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type java.util.Date of variable that.date does not match with type java.lang.String of variable that.labelFormat
   - Make classes java.util.Date and java.lang.String extend a common superclass

   Type java.util.Date of variable this.date does not match with type java.lang.String of variable this.labelFormat
   - Make classes java.util.Date and java.lang.String extend a common superclass

   6

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

   7

       return false;

   7

       return false;

   8

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

   8 | if (! this.high.equals(that.high))
   8 | if (! this.numberFormat.equals(that.numberFormat))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.labels.AbstractPieItemLabelGenerator | VARIABLE_TYPE_MISMATCH
   high | numberFormat | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.text.NumberFormat | VARIABLE_TYPE_MISMATCH
   high | numberFormat | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.text.NumberFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

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

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

   8

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

   9

       return false;

   9

       return false;

   10

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

   10 | if (! this.low.equals(that.low))
   10 | if (! this.percentFormat.equals(that.percentFormat))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.xy.OHLCDataItem | org.jfree.chart.labels.AbstractPieItemLabelGenerator | VARIABLE_TYPE_MISMATCH
   low | percentFormat | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.text.NumberFormat | VARIABLE_TYPE_MISMATCH
   low | percentFormat | VARIABLE_NAME_MISMATCH
   java.lang.Number | java.text.NumberFormat | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type java.lang.Number of variable that.low does not match with type java.text.NumberFormat of variable that.percentFormat
   - Make classes java.lang.Number and java.text.NumberFormat extend a common superclass

   Type java.lang.Number of variable this.low does not match with type java.text.NumberFormat of variable this.percentFormat
   - Make classes java.lang.Number and java.text.NumberFormat extend a common superclass

   10

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

   11

       return false;

   11

       return false;

   12

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

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

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

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       return true;

   12

       return true;

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof OHLCDataItem does not match with type boolean of variable obj instanceof AbstractPieItemLabelGenerator
   2 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable that
   3 | Type java.util.Date of variable that.date does not match with type java.lang.String of variable that.labelFormat
   4 | Type java.util.Date of variable this.date does not match with type java.lang.String of variable this.labelFormat
   5 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable that
   6 | Type java.lang.Number of variable that.high does not match with type java.text.NumberFormat of variable that.numberFormat
   7 | Type java.lang.Number of variable this.high does not match with type java.text.NumberFormat of variable this.numberFormat
   8 | Type org.jfree.data.xy.OHLCDataItem of variable that does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable that
   9 | Type java.lang.Number of variable that.low does not match with type java.text.NumberFormat of variable that.percentFormat
   10 | Type java.lang.Number of variable this.low does not match with type java.text.NumberFormat of variable this.percentFormat
   11 | Unmatched return false;
   12 | Unmatched return false;