43-19-30

if (obj == this) { return true; } if (!(obj instanceof LogFormat)) { return false; } LogFormat that = (LogFormat) obj; if (this.base != that.base) { return false; } if (!this.baseLabel.equals(that.baseLabel)) { return false; } if (this.baseLog != that.baseLog) { return false; } if (this.showBase != that.showBase) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof DefaultIntervalCategoryDataset)) { return false; } DefaultIntervalCategoryDataset that = (DefaultIntervalCategoryDataset) obj; if (!Arrays.equals(this.seriesKeys, that.seriesKeys)) { return false; } if (!Arrays.equals(this.categoryKeys, that.categoryKeys)) { return false; } if (!equal(this.startData, that.startData)) { return false; } if (!equal(this.endData, that.endData)) { return false; } // seem to be the same... return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/util/LogFormat.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/category/DefaultIntervalCategoryDataset.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 14 |  | 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 LogFormat)) {↵

4

            if (!(obj instanceof DefaultIntervalCategoryDataset)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            LogFormat that = (LogFormat) obj;↵

7

            ↵

8

            if (this.base != that.base↵

8

    DefaultIntervalCategoryDataset that ↵

9

                    = (DefaultIntervalCategoryDataset) obj;↵

9

    ) {↵

10

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

10

                return false;↵

11

                return false;↵

11

            }↵

12

            }↵

12

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

13

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

13

                return false;↵

14

                return false;↵

14

            }↵

15

            }↵

15

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

16

            if (!equal(this.startData, that.startData)) {↵

16

                return false;↵

17

                return false;↵

17

            }↵

18

            }↵

18

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

19

            if (!equal(this.endData, that.endData)) {↵

19

                return false;↵

20

                return false;↵

20

            }↵

21

            }↵

21

            return super.equals(obj)↵

22

            // seem to be the same...↵

22

    ;

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

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

   3 | if (!(obj instanceof LogFormat))
   3 | if (!(obj instanceof DefaultIntervalCategoryDataset))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.util.LogFormat | org.jfree.data.category.DefaultIntervalCategoryDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof LogFormat does not match with type boolean of variable obj instanceof DefaultIntervalCategoryDataset
   - Make classes org.jfree.chart.util.LogFormat and org.jfree.data.category.DefaultIntervalCategoryDataset extend a common superclass

   3

       if (!(obj instanceof DefaultIntervalCategoryDataset))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       DefaultIntervalCategoryDataset that = (DefaultIntervalCategoryDataset)obj;

   5

       LogFormat that = (LogFormat)obj;

   6

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

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   6

       if (this.base != that.base)

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

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

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   8

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

   8 | if (! this.baseLabel.equals(that.baseLabel))
   10 | if (! equal(this.startData, that.startData))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   equals | equal | METHOD_INVOCATION_NAME_MISMATCH
   this.baseLabel.equals(that.baseLabel) | equal(this.startData,that.startData) | ARGUMENT_NUMBER_MISMATCH
   this.baseLabel |  | MISSING_METHOD_INVOCATION_EXPRESSION

   10

       if (!equal(this.startData, that.startData))

   9

       return false;

   9 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

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