43-15-37

if (obj == this) { return true; } if (!(obj instanceof DateAxis)) { return false; } DateAxis that = (DateAxis) obj; if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) { return false; } if (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride)) { return false; } if (!ObjectUtilities.equal(this.tickMarkPosition, that.tickMarkPosition)) { return false; } if (!ObjectUtilities.equal(this.timeline, that.timeline)) { return false; } if (!super.equals(obj)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof SlidingGanttCategoryDataset)) { return false; } SlidingGanttCategoryDataset that = (SlidingGanttCategoryDataset) 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/axis/DateAxis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/gantt/SlidingGanttCategoryDataset.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

            }↵

4

            ↵

3

    		}↵

5

    if (!(obj instanceof DateAxis)) {↵

4

    		if (!(obj instanceof ↵

6

                return false;↵

7

            }↵

8

            DateAxis that = (DateAxis) obj;↵

9

            if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit)) {↵

10

                return false;↵

11

            }↵

12

            if (!ObjectUtilities.equal(this.dateFormatOverride,↵

13

                    that.dateFormatOverri↵

5

    SlidingGanttCategoryDataset)) {↵

6

    			return false;↵

7

    		}↵

8

    		SlidingGanttCategoryDataset that = (SlidingGanttCategoryDataset) obj;↵

14

    de)) {↵

9

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

15

                return false;↵

10

    			return false;↵

16

            }↵

17

            if (!ObjectUtilities.equal(this.tickMarkPosition,↵

18

                    that.tickMarkPosition)) {↵

19

                return false;↵

20

            }↵

21

            if (!ObjectUtilities↵

11

    		}↵

12

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

13

    			return false;↵

14

    		}↵

22

    .equal(this.timeline, that.timeline)) {↵

15

    		if (!this.underlying.equals(th↵

23

                return false;↵

24

            }↵

25

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

26

                return false;↵

27

            }↵

28

            ↵

16

    at.underlying)) {↵

17

    			return false;↵

18

    		}↵

29

    return true;

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 9
   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 DateAxis))

   3 | if (!(obj instanceof DateAxis))
   3 | if (!(obj instanceof SlidingGanttCategoryDataset))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.DateAxis | org.jfree.data.gantt.SlidingGanttCategoryDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof SlidingGanttCategoryDataset))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       SlidingGanttCategoryDataset that = (SlidingGanttCategoryDataset)obj;

   5

       DateAxis that = (DateAxis)obj;

   6

       if (this.firstCategoryIndex != that.firstCategoryIndex)

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   6

       if (!ObjectUtilities.equal(this.tickUnit, that.tickUnit))

   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 (!ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride))

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (!ObjectUtilities.equal(this.tickMarkPosition, that.tickMarkPosition))

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

       if (!ObjectUtilities.equal(this.timeline, that.timeline))

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

       if (!super.equals(obj))

   14 | if (! super.equals(obj))
   10 | if (! this.underlying.equals(that.underlying))

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

   10

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

   15

       return false;

   15 | 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 DateAxis does not match with type boolean of variable obj instanceof SlidingGanttCategoryDataset
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Unmatched return false;
   6 | Unmatched return false;
   7 | Unmatched return false;
   8 | Conditional return true;
   9 | Conditional return true;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;
   13 | Conditional return false;