43-20-86

if (obj == this) { return true; } if (!(obj instanceof FlowArrangement)) { return false; } FlowArrangement that = (FlowArrangement) obj; if (this.horizontalAlignment != that.horizontalAlignment) { return false; } if (this.verticalAlignment != that.verticalAlignment) { return false; } if (this.horizontalGap != that.horizontalGap) { return false; } if (this.verticalGap != that.verticalGap) { 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/block/FlowArrangement.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: 14 |  | Number of AST nodes: 10

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                    return true;↵

3

       ↵

3

       ↵

4

            }↵

4

             }↵

5

            if (!(obj instanceof FlowArrangement)) {↵

5

                if (!(obj instanceof PaintItem)) {↵

6

                return false;↵

6

                    return false;↵

7

       ↵

7

        ↵

8

            }↵

8

            }↵

9

            FlowArrangement that = (FlowArrangement) obj;↵

9

                PaintItem that = (PaintItem) obj;↵

10

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

10

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

11

                return false;↵

11

                    return false;↵

12

            }↵

12

                }↵

13

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

13

                if (↵

14

                return false;↵

15

            }↵

16

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

14

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

17

                return false;   ↵

15

                    return false;↵

18

            }↵

16

            ↵

19

        ↵

17

        }↵

20

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

18

        ↵

21

                return false;   ↵

22

            }↵

23

            return true;

19

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

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 | 1
   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 FlowArrangement))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.FlowArrangement | org.jfree.chart.renderer.LookupPaintScale.PaintItem | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

       FlowArrangement that = (FlowArrangement)obj;

   6

       if (this.horizontalAlignment != that.horizontalAlignment)

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

       if (this.verticalAlignment != that.verticalAlignment)

   9

       return false;

   9 | return false;

   Preondition Violations
   Unmatched return false;

   10

       if (this.horizontalGap != that.horizontalGap)

   10 | if (this.horizontalGap != that.horizontalGap)
   6 | if (this.value != that.value)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   horizontalGap | value | VARIABLE_NAME_MISMATCH
   org.jfree.chart.block.FlowArrangement | org.jfree.chart.renderer.LookupPaintScale.PaintItem | VARIABLE_TYPE_MISMATCH
   horizontalGap | value | VARIABLE_NAME_MISMATCH

   Preondition Violations

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

   6

       if (this.value != that.value)

   11

       return false;

   11 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

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