43-13-86

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 PaintItem)) { return false; } PaintItem that = (PaintItem) obj; if (this.value != that.value) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { 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/renderer/LookupPaintScale.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 PaintItem)) {↵

5

                return false;↵

5

                    return false;↵

6

            }↵

6

                }↵

7

            MeterInterval that = (MeterInterval) obj;↵

7

                PaintItem that = (PaintItem) obj;↵

8

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

8

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

9

                return false;↵

9

                    return false;↵

10

            }↵

10

            ↵

11

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

12

                return false;↵

13

            }↵

11

        }↵

14

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

12

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

15

                return false;↵

13

                ↵

16

            }↵

17

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

18

                return false;↵

19

            }↵

20

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

21

                return false;↵

22

            }↵

14

        return false;↵

15

                }↵

23

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

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 6
   Number of unmapped statements in the first code fragment | 5
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 0.7
   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 MeterInterval))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.MeterInterval | org.jfree.chart.renderer.LookupPaintScale.PaintItem | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof PaintItem))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       PaintItem that = (PaintItem)obj;

   5

       MeterInterval that = (MeterInterval)obj;

   6

       if (this.value != that.value)

   7 | return false;

   Preondition Violations
   Unmatched return false;

   7

       return false;

   6

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

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

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

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

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

   10 | if (! PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
   8 | if (! PaintUtilities.equal(this.paint, that.paint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   outlinePaint | paint | VARIABLE_NAME_MISMATCH
   org.jfree.chart.plot.MeterInterval | org.jfree.chart.renderer.LookupPaintScale.PaintItem | VARIABLE_TYPE_MISMATCH
   outlinePaint | paint | VARIABLE_NAME_MISMATCH

   Preondition Violations

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

   8

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

   11

       return false;

   11 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   Precondition Violations (11)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof MeterInterval does not match with type boolean of variable obj instanceof PaintItem
   2 | Unmatched return false;
   3 | Unmatched return false;
   4 | Unmatched return false;
   5 | Type org.jfree.chart.plot.MeterInterval of variable that does not match with type org.jfree.chart.renderer.LookupPaintScale.PaintItem of variable that
   6 | Conditional return true;
   7 | Conditional return true;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;
   11 | Conditional return false;