342-1-7

if (this == obj) { return true; } if (!(obj instanceof CategoryLabelPositions)) { return false; } CategoryLabelPositions that = (CategoryLabelPositions) obj; if (!this.positionForAxisAtTop.equals(that.positionForAxisAtTop)) { return false; } if (!this.positionForAxisAtBottom.equals( that.positionForAxisAtBottom)) { return false; } if (!this.positionForAxisAtLeft.equals(that.positionForAxisAtLeft)) { return false; } if (!this.positionForAxisAtRight.equals(that.positionForAxisAtRight)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof IntervalMarker)) { return false; } if (!super.equals(obj)) { return false; } IntervalMarker that = (IntervalMarker) obj; if (this.startValue != that.startValue) { return false; } if (this.endValue != that.endValue) { return false; } if (!ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryLabelPositions.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/IntervalMarker.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 14 |  | Number of AST nodes: 14

1

    if (this == obj) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;   ↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof CategoryLabelPositions)) {↵

4

            if (!(obj instanceof IntervalMarker)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            CategoryLabelPositions that = (CategoryLabelPositions) obj;↵

8

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

7

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

9

                return false;↵

8

                return false;↵

10

            }↵

9

            }↵

11

            if (!this.positionForAxisAtBottom.equals(↵

10

            ↵

12

                    that.positionForAxisAtBottom)↵

11

    IntervalMarker that = (IntervalMarker) obj;↵

13

    ) {↵

12

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

14

                return false;↵

13

                return false;   ↵

15

            }↵

14

            }↵

16

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

15

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

17

                return false;↵

16

                return false;   ↵

18

            }↵

17

            }↵

19

            if (!this.positionForAxisAtRight.equals(that.positionForAxisAtRight↵

18

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

20

    )) {↵

19

                    that.gradientPaintTransformer)) {↵

21

                return false;↵

20

                return false;   ↵

22

            }↵

21

            }↵

23

      ↵

24

            return true;

22

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

1. {Non-refactorable}

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

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

   3

       if (!(obj instanceof CategoryLabelPositions))

   3 | if (!(obj instanceof CategoryLabelPositions))
   3 | if (!(obj instanceof IntervalMarker))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.CategoryLabelPositions | org.jfree.chart.plot.IntervalMarker | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof CategoryLabelPositions does not match with type boolean of variable obj instanceof IntervalMarker
   - Make classes org.jfree.chart.axis.CategoryLabelPositions and org.jfree.chart.plot.IntervalMarker extend a common superclass

   3

       if (!(obj instanceof IntervalMarker))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       CategoryLabelPositions that = (CategoryLabelPositions)obj;

   6

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

   6 | if (! this.positionForAxisAtTop.equals(that.positionForAxisAtTop))
   5 | if (! super.equals(obj))

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

   5

       if (!super.equals(obj))

   7

       return false;

   7 | return false;
   6 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   6

       return false;

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof CategoryLabelPositions does not match with type boolean of variable obj instanceof IntervalMarker
   2 | Conditional return false;
   3 | Conditional return false;
   4 | Conditional return false;
   5 | Conditional return false;