43-13-98

if (obj == this) { return true; } if (!(obj instanceof MeterInterval)) { return false; } MeterInterval that = (MeterInterval) obj; if (!this.label.equals(that.label)) { return false; } if (!this.range.equals(that.range)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!ObjectUtilities.equal(this.outlineStroke, that.outlineStroke)) { return false; } if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof CompositeTitle)) { return false; } if (!super.equals(obj)) { return false; } CompositeTitle that = (CompositeTitle) obj; if (!this.container.equals(that.container)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/MeterInterval.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/title/CompositeTitle.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 16 |  | Number of AST nodes: 10

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;   ↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof MeterInterval)) {↵

4

            if (!(obj instanceof CompositeTitle)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

       ↵

7

            MeterInterval that = (MeterInterval) obj;↵

7

            }↵

8

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

8

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

9

                return false;↵

9

                return false;↵

10

            }↵

11

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

12

                return false;↵

13

            }↵

14

            if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {↵

15

                return false;↵

16

            }↵

17

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

18

                return false;↵

19

            }↵

20

            if (!PaintUtilities↵

10

       ↵

11

            }↵

12

            CompositeTitle that = (CompositeTitle) obj;↵

21

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

13

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

22

                return false;↵

14

                return false;   ↵

23

            }↵

15

            }↵

24

            return true;

16

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 9
   Number of unmapped statements in the first code fragment | 7
   Number of unmapped statements in the second code fragment | 1
   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;

   3

       if (!(obj instanceof MeterInterval))

   3 | if (!(obj instanceof MeterInterval))
   3 | if (!(obj instanceof CompositeTitle))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.MeterInterval | org.jfree.chart.title.CompositeTitle | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof CompositeTitle))

   4

       return false;

   4

       return false;

   5

       MeterInterval that = (MeterInterval)obj;

   6

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

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

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

   5

       if (!super.equals(obj))

   7

       return false;

   6

       return false;

   7

       CompositeTitle that = (CompositeTitle)obj;

   8

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

   8 | if (! this.range.equals(that.range))
   8 | if (! this.container.equals(that.container))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.MeterInterval | org.jfree.chart.title.CompositeTitle | VARIABLE_TYPE_MISMATCH
   range | container | VARIABLE_NAME_MISMATCH
   org.jfree.data.Range | org.jfree.chart.block.BlockContainer | VARIABLE_TYPE_MISMATCH
   range | container | VARIABLE_NAME_MISMATCH
   org.jfree.data.Range | org.jfree.chart.block.BlockContainer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.plot.MeterInterval of variable that does not match with type org.jfree.chart.title.CompositeTitle of variable that
   - Make classes org.jfree.chart.plot.MeterInterval and org.jfree.chart.title.CompositeTitle extend a common superclass

   Type org.jfree.data.Range of variable that.range does not match with type org.jfree.chart.block.BlockContainer of variable that.container
   - Make classes org.jfree.data.Range and org.jfree.chart.block.BlockContainer extend a common superclass

   Type org.jfree.data.Range of variable this.range does not match with type org.jfree.chart.block.BlockContainer of variable this.container
   - Make classes org.jfree.data.Range and org.jfree.chart.block.BlockContainer extend a common superclass

   8

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

   9

       return false;

   9

       return false;

   10

       if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))

   11

       return false;

   11 | return false;

   Preondition Violations
   Unmatched return false;

   12

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

   13

       return false;

   13 | return false;

   Preondition Violations
   Unmatched return false;

   14

       if (!PaintUtilities.equal(this.backgroundPaint, that.backgroundPaint))

   15

       return false;

   15 | return false;

   Preondition Violations
   Unmatched return false;

   16

       return true;

   10

       return true;

   Precondition Violations (7)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof MeterInterval does not match with type boolean of variable obj instanceof CompositeTitle
   2 | Type org.jfree.chart.plot.MeterInterval of variable that does not match with type org.jfree.chart.title.CompositeTitle of variable that
   3 | Type org.jfree.data.Range of variable that.range does not match with type org.jfree.chart.block.BlockContainer of variable that.container
   4 | Type org.jfree.data.Range of variable this.range does not match with type org.jfree.chart.block.BlockContainer of variable this.container
   5 | Unmatched return false;
   6 | Unmatched return false;
   7 | Unmatched return false;