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; }
if (obj == this) { return true; } if (!(obj instanceof XYDotRenderer)) { return false; } XYDotRenderer that = (XYDotRenderer) obj; if (this.dotWidth != that.dotWidth) { return false; } if (this.dotHeight != that.dotHeight) { return false; } if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) { 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/xy/XYDotRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 11 Number of AST nodes: 12
1
if (obj instanceof Tick) {
1
if (obj == this) {
2
            Tick t = (Tick) obj;
2
            return true;
3
   
3
        }
4
            if (!ObjectUtilities.equal(this.text, t.text)) {
4
        if (!(obj instanceof XYDotRenderer)) {
5
                return false;
5
            return false;
6
   
6
        }
7
            }
7
        
8
            if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor)
8
XYDotRenderer that = (XYDotRenderer) obj;
9
) {
9
        if (this.dotWidth != that.dotWidth) {
10
                return false;   
10
            return false;
11
    
12
        }
11
        }
13
            if (!ObjectUtilities.equal(this.rotationAnchor, t.rotationAnchor)) {
12
        if (this.dotHeight != that.dotHeight) {
14
                return false;   
13
            return false;
15
   
16
         }
14
        }
17
            if (!(this.angle == t.angle)) {
15
        if (!ShapeUtilities.equal(this.legendShape, that.legendShape)) {
18
                return false;   
16
            return false;
19
            }
17
        
20
    
18
}
21
        return true;
19
        return 
22
        }
20
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 comparisons30
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    4
    Tick t = (Tick)obj;
                                            
                                                                                      
    5
    XYDotRenderer that = (XYDotRenderer)obj;
                                                                              
    6
    if (this.dotWidth != that.dotWidth)
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
                                                                                  
    8
    if (this.dotHeight != that.dotHeight)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    5
    if (!ObjectUtilities.equal(this.text, t.text))
    5
    if (!ObjectUtilities.equal(this.text, t.text))
    10
    if (!ShapeUtilities.equal(this.legendShape, that.legendShape))
    Differences
    Expression1Expression2Difference
    textlegendShapeVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.ShapeVARIABLE_TYPE_MISMATCH
    tthatVARIABLE_NAME_MISMATCH
    org.jfree.chart.axis.Tickorg.jfree.chart.renderer.xy.XYDotRendererVARIABLE_TYPE_MISMATCH
    textlegendShapeVARIABLE_NAME_MISMATCH
    java.lang.Stringjava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.ShapeUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable this.text does not match with type java.awt.Shape of variable this.legendShape
    • Make classes java.lang.String and java.awt.Shape extend a common superclass
    Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendShape cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable t.text does not match with type java.awt.Shape of variable that.legendShape
    • Make classes org.jfree.chart.axis.Tick and org.jfree.chart.renderer.xy.XYDotRenderer extend a common superclass
    Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendShape cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.String of variable t.text does not match with type java.awt.Shape of variable that.legendShape
    • Make classes java.lang.String and java.awt.Shape extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.ShapeUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.ShapeUtilities extend a common superclass
    10
    if (!ShapeUtilities.equal(this.legendShape, that.legendShape))
    6
    return false;
    11
    return false;
    7
    if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))
    7
    if (!ObjectUtilities.equal(this.textAnchor, t.textAnchor))
    3
    if (!(obj instanceof XYDotRenderer))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.textAnchor,t.textAnchor)(obj instanceof XYDotRenderer)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.textAnchor,t.textAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (!(obj instanceof XYDotRenderer))
    8
    return false;
    4
    return false;
    Precondition Violations (12)
    Row Violation
    1Unmatched return false;
    2Unmatched return false;
    3Type java.lang.String of variable this.text does not match with type java.awt.Shape of variable this.legendShape
    4Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.legendShape cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type java.lang.String of variable t.text does not match with type java.awt.Shape of variable that.legendShape
    7Expression t.text cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.legendShape cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Type java.lang.String of variable t.text does not match with type java.awt.Shape of variable that.legendShape
    10Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.ShapeUtilities
    11Expression ObjectUtilities.equal(this.textAnchor,t.textAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Not all possible execution flows end in a return statement