295-3-5

if (object == null) { return false; } if (object == this) { return true; } if (super.equals(object) && object instanceof ShipNeedle) { return true; } return false;
if (object == null) { return false; } if (object == this) { return true; } if (super.equals(object) && object instanceof WindNeedle) { return true; } return false;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/needle/ShipNeedle.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/needle/WindNeedle.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    if (object == null) {↵

1

    if (object == null) {↵

2

                return false;↵

2

                return false;↵

3

            }↵

3

            }↵

4

            if (object == this) {↵

4

            if (object == this) {↵

5

                return true;↵

5

                return true;↵

6

            }↵

6

            }↵

7

            if (super.equals(object) && object instanceof ShipNeedle) {↵

7

            if (super.equals(object) && object instanceof WindNeedle) {↵

8

                return true;↵

8

                return true;↵

9

            }↵

9

            }↵

10

            return false;

10

            return false;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 1
Number of non-refactorable cases | 0
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 28

1. {Refactorable}

   Mapping Summary
   Number of mapped statements | 7
   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 (object == null)

   1

       if (object == null)

   2

       return false;

   2

       return false;

   3

       if (object == this)

   3

       if (object == this)

   4

       return true;

   4

       return true;

   5

       if (super.equals(object) && object instanceof ShipNeedle)

   5 | if (super.equals(object) && object instanceof ShipNeedle)
   5 | if (super.equals(object) && object instanceof WindNeedle)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.needle.ShipNeedle | org.jfree.chart.needle.WindNeedle | SUBCLASS_TYPE_MISMATCH

   5

       if (super.equals(object) && object instanceof WindNeedle)

   6

       return true;

   6

       return true;

   7

       return false;

   7

       return false;

   Precondition Violations (0)
   Row | Violation
   --- | ---