43-19-41

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 SlidingCategoryDataset)) { return false; } SlidingCategoryDataset that = (SlidingCategoryDataset) obj; if (this.firstCategoryIndex != that.firstCategoryIndex) { return false; } if (this.maximumCategoryCount != that.maximumCategoryCount) { return false; } if (!this.underlying.equals(that.underlying)) { return false; } 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/SlidingCategoryDataset.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 14 |  | Number of AST nodes: 12

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

    			return true;↵

3

            }↵

4

            ↵

3

    		}↵

5

    if (!(obj instanceof LogFormat)) {↵

4

    		if (!(obj instanceof ↵

6

                return false;↵

7

            }↵

8

            LogFormat that = (LogFormat) obj;↵

9

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

10

                return false;↵

11

            }↵

12

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

13

                return false;↵

14

            }↵

15

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

16

                return false;↵

17

            }↵

18

            ↵

5

    SlidingCategoryDataset)) {↵

6

    			return false;↵

7

    		}↵

8

    		SlidingCategoryDataset that = (SlidingCategoryDataset) obj;↵

9

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

10

    			return false;↵

11

    		}↵

12

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

13

    			return false;↵

14

    		}↵

19

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

15

    		if (!this.↵

20

                return false;↵

21

            }↵

22

            return super.equals(obj)↵

16

    underlying.equals(that.underlying)) {↵

17

    			return false;↵

18

    		}↵

23

    ;

19

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

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.7
   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 SlidingCategoryDataset))

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

   Preondition Violations

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

   3

       if (!(obj instanceof SlidingCategoryDataset))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       SlidingCategoryDataset that = (SlidingCategoryDataset)obj;

   5

       LogFormat that = (LogFormat)obj;

   6

       if (this.firstCategoryIndex != that.firstCategoryIndex)

   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 (this.maximumCategoryCount != that.maximumCategoryCount)

   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 (! this.underlying.equals(that.underlying))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.util.LogFormat | org.jfree.data.category.SlidingCategoryDataset | VARIABLE_TYPE_MISMATCH
   baseLabel | underlying | VARIABLE_NAME_MISMATCH
   java.lang.String | org.jfree.data.category.CategoryDataset | VARIABLE_TYPE_MISMATCH
   baseLabel | underlying | VARIABLE_NAME_MISMATCH
   java.lang.String | org.jfree.data.category.CategoryDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   Type java.lang.String of variable that.baseLabel does not match with type org.jfree.data.category.CategoryDataset of variable that.underlying
   - Make classes java.lang.String and org.jfree.data.category.CategoryDataset extend a common superclass

   Type java.lang.String of variable this.baseLabel does not match with type org.jfree.data.category.CategoryDataset of variable this.underlying
   - Make classes java.lang.String and org.jfree.data.category.CategoryDataset extend a common superclass

   10

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

   9

       return false;

   9 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

   Precondition Violations (13)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof LogFormat does not match with type boolean of variable obj instanceof SlidingCategoryDataset
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Type org.jfree.chart.util.LogFormat of variable that does not match with type org.jfree.data.category.SlidingCategoryDataset of variable that
   6 | Type java.lang.String of variable that.baseLabel does not match with type org.jfree.data.category.CategoryDataset of variable that.underlying
   7 | Type java.lang.String of variable this.baseLabel does not match with type org.jfree.data.category.CategoryDataset of variable this.underlying
   8 | Conditional return true;
   9 | Conditional return true;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;