453-3-7

if (this == obj) { return true; } if (obj instanceof Tick) { Tick t = (Tick) obj; if (!ObjectUtilities.equal(this.text, t.text)) { return false; } if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) { return false; } if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) { return false; } if (!(this.angle == t.angle)) { return false; } return true; } return false;
if (obj == this) { return true; } if (!(obj instanceof GanttRenderer)) { return false; } GanttRenderer that = (GanttRenderer) obj; if (!PaintUtilities.equal(this.completePaint, that.completePaint)) { return false; } if (!PaintUtilities.equal(this.incompletePaint, that.incompletePaint)) { return false; } if (this.startPercent != that.startPercent) { return false; } if (this.endPercent != that.endPercent) { return false; } return super.equals(obj);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/Tick.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/GanttRenderer.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 14 |  | Number of AST nodes: 14

1

    if (this == obj) {↵

1

    if (obj == this) {↵

2

                return true;   ↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (obj instanceof Tick) {↵

4

            if (!(obj instanceof GanttRenderer)) {↵

5

                Tick t = (Tick↵

5

                return false;↵

6

            }↵

6

    ) obj;   ↵

7

            GanttRenderer that = (GanttRenderer) obj;↵

7

                if (!ObjectUtilities.equal(this.text, t.text)) {↵

8

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

8

                    return false;   ↵

9

                return false;↵

9

                }↵

10

            }↵

10

                if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)) {↵

11

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

11

                    return false;   ↵

12

                return false;↵

12

      ↵

13

              }↵

13

            }↵

14

                if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) {↵

14

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

15

                    return false;   ↵

15

                return false;↵

16

                }↵

16

            ↵

17

       ↵

17

    }↵

18

             if (!(this.angle == t.angle)) {↵

18

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

19

                    return false;   ↵

19

                return false;↵

20

        ↵

21

            }↵

20

            }↵

22

                return true;↵

21

            return ↵

23

            }↵

24

            return false;

22

    super.equals(obj);

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 | 43

1. {Non-refactorable}

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

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

   4

       Tick t = (Tick)obj;

   5

       GanttRenderer that = (GanttRenderer)obj;

   5

       if (!ObjectUtilities.equal(this.text, t.text))

   5 | if (! ObjectUtilities.equal(this.text, t.text))
   6 | if (! PaintUtilities.equal(this.completePaint, that.completePaint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   text | completePaint | VARIABLE_NAME_MISMATCH
   java.lang.String | java.awt.Paint | VARIABLE_TYPE_MISMATCH
   org.jfree.util.ObjectUtilities | org.jfree.util.PaintUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.lang.String of variable this.text does not match with type java.awt.Paint of variable this.completePaint
   - Make classes java.lang.String and java.awt.Paint extend a common superclass

   Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   - Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass

   6

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

   6

       return false;

   6 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

   7

       if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))

   7 | if (! ObjectUtilities.equal(this.textAnchor, t.textAnchor))
   8 | if (! PaintUtilities.equal(this.incompletePaint, that.incompletePaint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   textAnchor | incompletePaint | VARIABLE_NAME_MISMATCH
   org.jfree.ui.TextAnchor | java.awt.Paint | VARIABLE_TYPE_MISMATCH
   org.jfree.util.ObjectUtilities | org.jfree.util.PaintUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type java.awt.Paint of variable this.incompletePaint
   - Make classes org.jfree.ui.TextAnchor and java.awt.Paint extend a common superclass

   Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   - Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass

   8

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

   8

       return false;

   8 | return false;
   9 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   9

       return false;

   9

       if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor))

   9 | if (! ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor))
   3 | if (!(obj instanceof GanttRenderer))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   ObjectUtilities.equal(this.rotationAnchor,t.rotationAnchor) | (obj instanceof GanttRenderer) | TYPE_COMPATIBLE_REPLACEMENT

   3

       if (!(obj instanceof GanttRenderer))

   10

       return false;

   10 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   Precondition Violations (10)
   Row | Violation
   --- | ---
   1 | Type java.lang.String of variable this.text does not match with type java.awt.Paint of variable this.completePaint
   2 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   3 | Type org.jfree.ui.TextAnchor of variable this.textAnchor does not match with type java.awt.Paint of variable this.incompletePaint
   4 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   5 | Conditional return false;
   6 | Conditional return false;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;