43-15-145

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 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/DateAxis.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: 16 |  | 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 DateAxis)) {↵

4

            if (!(obj instanceof IntervalMarker)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            DateAxis that = (DateAxis) obj;↵

7

            ↵

8

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

9

                return false;↵

10

            }↵

11

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

12

                    that.dateFormatOverride)↵

8

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

9

                return false;↵

10

            }↵

11

            IntervalMarker that = (IntervalMarker) obj;↵

13

    ) {↵

12

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

14

                return false;↵

13

                return false;   ↵

15

            }↵

14

            }↵

16

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

15

            if (↵

17

                    that.tickMarkPosition)) {↵

16

    this.endValue != that.endValue) {↵

18

                return false;↵

17

                return false;   ↵

19

            }↵

18

            }↵

20

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

19

            if (!ObjectUtilities.equal(this.↵

21

                return false;↵

20

    gradientPaintTransformer, ↵

22

            }↵

21

            ↵

23

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

22

            that.gradientPaintTransformer)) {↵

24

                return false;↵

23

                return false;   ↵

25

            }↵

24

            }↵

26

            return true;

25

            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 | 73

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 8
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 5
   Time elapsed for statement mapping (ms) | 1.0
   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 IntervalMarker))

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

   Preondition Violations

   Type boolean of variable obj instanceof DateAxis does not match with type boolean of variable obj instanceof IntervalMarker
   - Make classes org.jfree.chart.axis.DateAxis 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

       DateAxis that = (DateAxis)obj;

   6

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

   6 | if (! ObjectUtilities.equal(this.tickUnit, that.tickUnit))
   5 | if (! super.equals(obj))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   ObjectUtilities.equal(this.tickUnit,that.tickUnit) | 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;

   7

       IntervalMarker that = (IntervalMarker)obj;

   8

       if (this.startValue != that.startValue)

   9 | return false;

   Preondition Violations
   Unmatched return false;

   9

       return false;

   10

       if (this.endValue != that.endValue)

   11 | return false;

   Preondition Violations
   Unmatched return false;

   11

       return false;

   8

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

   8 | if (! ObjectUtilities.equal(this.dateFormatOverride, that.dateFormatOverride))
   12 | if (! ObjectUtilities.equal(this.gradientPaintTransformer, that.gradientPaintTransformer))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   dateFormatOverride | gradientPaintTransformer | VARIABLE_NAME_MISMATCH
   java.text.DateFormat | org.jfree.ui.GradientPaintTransformer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.text.DateFormat of variable this.dateFormatOverride does not match with type org.jfree.ui.GradientPaintTransformer of variable this.gradientPaintTransformer
   - Make classes java.text.DateFormat and org.jfree.ui.GradientPaintTransformer extend a common superclass

   12

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

   9

       return false;

   9 | return false;
   13 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   13

       return false;

   Precondition Violations (12)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof DateAxis does not match with type boolean of variable obj instanceof IntervalMarker
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Type java.text.DateFormat of variable this.dateFormatOverride does not match with type org.jfree.ui.GradientPaintTransformer of variable this.gradientPaintTransformer
   5 | Conditional return true;
   6 | Conditional return true;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;
   12 | Conditional return false;