43-20-108

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 == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof HistogramType)) { return false; } HistogramType t = (HistogramType) obj; if (!this.name.equals(t.name)) { 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/data/statistics/HistogramType.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 == null) {↵

2

                return true;   ↵

2

                return false;   ↵

3

            }↵

3

            }↵

4

            ↵

4

            if (!(obj instanceof FlowArrangement)) {↵

5

            if (obj == this) {↵

5

                return false;   ↵

6

                return true;↵

6

            }↵

7

            }↵

7

            FlowArrangement that = (FlowArrangement) obj;↵

8

            ↵

8

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

9

                return false;↵

10

            }↵

11

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

12

                return false;↵

13

            }↵

14

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

15

                return false;   ↵

16

            }↵

9

            if (!(obj instanceof HistogramType)) {↵

10

                return false;↵

11

            }↵

12

            ↵

13

            HistogramType t = (HistogramType) obj;↵

17

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

14

            if (!this.name.equals(t.name)) {↵

18

                return false;   ↵

15

                return false;↵

19

            }↵

16

            }↵

17

            ↵

20

            return true;

18

            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) | 0.8
Clones location | Clones are in different classes
Number of node comparisons | 33

1. {Non-refactorable}

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

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

   1

       if (obj == this)

   3

       if (obj == this)

   2

       return true;

   2 | return true;
   4 | return true;

   Preondition Violations
   Conditional return true;
   Conditional return true;

   4

       return true;

   3

       if (!(obj instanceof FlowArrangement))

   3 | if (!(obj instanceof FlowArrangement))
   5 | if (!(obj instanceof HistogramType))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.block.FlowArrangement | org.jfree.data.statistics.HistogramType | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof FlowArrangement does not match with type boolean of variable obj instanceof HistogramType
   - Make classes org.jfree.chart.block.FlowArrangement and org.jfree.data.statistics.HistogramType extend a common superclass

   5

       if (!(obj instanceof HistogramType))

   4

       return false;

   4 | 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 FlowArrangement does not match with type boolean of variable obj instanceof HistogramType
   2 | Conditional return true;
   3 | Conditional return true;
   4 | Conditional return false;
   5 | Conditional return false;