342-4-13

if (obj == this) { return true; } if (!(obj instanceof CombinedDomainCategoryPlot)) { return false; } if (!super.equals(obj)) { return false; } CombinedDomainCategoryPlot plot = (CombinedDomainCategoryPlot) obj; if (!ObjectUtilities.equal(this.subplots, plot.subplots)) { return false; } if (this.totalWeight != plot.totalWeight) { return false; } if (this.gap != plot.gap) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof TimeTableXYDataset)) { return false; } TimeTableXYDataset that = (TimeTableXYDataset) obj; if (this.domainIsPointsInTime != that.domainIsPointsInTime) { return false; } if (this.xPosition != that.xPosition) { return false; } if (!this.workingCalendar.getTimeZone().equals( that.workingCalendar.getTimeZone()) ) { return false; } if (!this.values.equals(that.values)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedDomainCategoryPlot.java |  | File path: /jfreechart-1.0.10/src/org/jfree/data/time/TimeTableXYDataset.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 CombinedDomainCategoryPlot)) {↵

4

            if (!(obj instanceof TimeTableXYDataset)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

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

7

            ↵

8

                return false;↵

9

            }↵

10

            CombinedDomainCategoryPlot plot = (CombinedDomainCategoryPlot) obj;↵

11

            if (!ObjectUtilities.equal(this.subplots, plot.subplots)↵

8

    TimeTableXYDataset that = (TimeTableXYDataset) obj;↵

9

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

10

                return false;↵

11

            }↵

12

    ) {↵

12

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

13

                return false;↵

13

                return false;↵

14

            }↵

14

            }↵

15

            if (this.totalWeight != plot.totalWeight↵

15

            if (!this.workingCalendar.getTimeZone().equals(↵

16

                that.workingCalendar.getTimeZone())↵

16

    ) {↵

17

            ) {↵

17

                return false;↵

18

                return false;↵

18

            }↵

19

            }↵

19

            if (this.gap != plot.gap) {↵

20

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

20

                return false;↵

21

                return false;↵

21

            }↵

22

            }↵

22

            return true;

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.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 | 0
   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 CombinedDomainCategoryPlot))

   3 | if (!(obj instanceof CombinedDomainCategoryPlot))
   3 | if (!(obj instanceof TimeTableXYDataset))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.CombinedDomainCategoryPlot | org.jfree.data.time.TimeTableXYDataset | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof CombinedDomainCategoryPlot does not match with type boolean of variable obj instanceof TimeTableXYDataset
   - Make classes org.jfree.chart.plot.CombinedDomainCategoryPlot and org.jfree.data.time.TimeTableXYDataset extend a common superclass

   3

       if (!(obj instanceof TimeTableXYDataset))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       TimeTableXYDataset that = (TimeTableXYDataset)obj;

   6

       if (this.domainIsPointsInTime != that.domainIsPointsInTime)

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   8

       if (this.xPosition != that.xPosition)

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   5

       if (!super.equals(obj))

   5 | if (! super.equals(obj))
   10 | if (! this.workingCalendar.getTimeZone().equals(that.workingCalendar.getTimeZone()))

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

   10

       if (!this.workingCalendar.getTimeZone().equals(that.workingCalendar.getTimeZone()))

   6

       return false;

   6 | return false;
   11 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   11

       return false;

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