if (obj instanceof CategoryTick && super.equals(obj)) { CategoryTick that = (CategoryTick) obj; if (!ObjectUtilities.equal(this.category, that.category)) { return false; } if (!ObjectUtilities.equal(this.label, that.label)) { return false; } if (!ObjectUtilities.equal(this.labelAnchor, that.labelAnchor)) { return false; } return true; }
if (obj == this) { return true; } if (!(obj instanceof DialPointer.Pin)) { return false; } DialPointer.Pin that = (DialPointer.Pin) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!this.stroke.equals(that.stroke)) { return false; } return super.equals(obj);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/CategoryTick.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/dial/DialPointer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 9 Number of AST nodes: 10
1
if (obj instanceof CategoryTick && super.equals(obj)) {
1
if (obj 
2
            CategoryTick that = (CategoryTick) obj;
2
== this) {
3
                return true;
3
   
4
            }
4
            if (!ObjectUtilities.equal(this.category, that.category)) {
5
            if (!(obj instanceof DialPointer.Pin)) {
5
                return false;
6
                return false;
6
   
7
            }
7
            }
8
            DialPointer.Pin that = (DialPointer.Pin) obj;
8
            if (!ObjectUtilities.equal(this.label, that.label)) {
9
            if (!PaintUtilities.equal(this.paint, that.paint)) {
9
                return false;   
10
                return false;
10
            }
11
            }
11
            if (!ObjectUtilities.equal(this.labelAnchor, that.labelAnchor)) {
12
            if (!this.stroke.equals(that.stroke)) {
12
                return false;   
13
                return false;
13
           }
14
            }
14
            return true;
15
            return 
15
        }
16
super.equals(obj);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)1.4
Clones locationClones are in different classes
Number of node comparisons31
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    CategoryTick that = (CategoryTick)obj;
                                                                                  
    5
    if (!ObjectUtilities.equal(this.category, that.category))
    5
    if (!ObjectUtilities.equal(this.category, that.category))
    6
    if (!PaintUtilities.equal(this.paint, that.paint))
    Differences
    Expression1Expression2Difference
    categorypaintVARIABLE_NAME_MISMATCH
    java.lang.Comparablejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.axis.CategoryTickorg.jfree.chart.plot.dial.DialPointer.PinVARIABLE_TYPE_MISMATCH
    categorypaintVARIABLE_NAME_MISMATCH
    java.lang.Comparablejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Comparable of variable this.category does not match with type java.awt.Paint of variable this.paint
    • Make classes java.lang.Comparable and java.awt.Paint extend a common superclass
    Type java.lang.Comparable of variable that.category does not match with type java.awt.Paint of variable that.paint
    • Make classes org.jfree.chart.axis.CategoryTick and org.jfree.chart.plot.dial.DialPointer.Pin extend a common superclass
    Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Comparable of variable that.category does not match with type java.awt.Paint of variable that.paint
    • Make classes java.lang.Comparable and java.awt.Paint extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass
    6
    if (!PaintUtilities.equal(this.paint, that.paint))
    6
    return false;
    7
    return false;
    7
    if (!ObjectUtilities.equal(this.label, that.label))
    7
    if (!ObjectUtilities.equal(this.label, that.label))
    3
    if (!(obj instanceof DialPointer.Pin))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.label,that.label)(obj instanceof DialPointer.Pin)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.label,that.label) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (!(obj instanceof DialPointer.Pin))
    8
    return false;
    4
    return false;
                                                                                              
    5
    DialPointer.Pin that = (DialPointer.Pin)obj;
    9
    if (!ObjectUtilities.equal(this.labelAnchor, that.labelAnchor))
    9
    if (!ObjectUtilities.equal(this.labelAnchor, that.labelAnchor))
    8
    if (!this.stroke.equals(that.stroke))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.labelAnchor,that.labelAnchor)this.stroke.equals(that.stroke)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.labelAnchor,that.labelAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.stroke.equals(that.stroke) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!this.stroke.equals(that.stroke))
    10
    return false;
    9
    return false;
    Precondition Violations (10)
    Row Violation
    1Type java.lang.Comparable of variable this.category does not match with type java.awt.Paint of variable this.paint
    2Type java.lang.Comparable of variable that.category does not match with type java.awt.Paint of variable that.paint
    3Expression that.category cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.lang.Comparable of variable that.category does not match with type java.awt.Paint of variable that.paint
    6Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    7Expression ObjectUtilities.equal(this.label,that.label) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression ObjectUtilities.equal(this.labelAnchor,that.labelAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression this.stroke.equals(that.stroke) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Not all possible execution flows end in a return statement