if (obj == this) { return true; } if (!(obj instanceof ControlPoint)) { return false; } ControlPoint that = (ControlPoint) obj; if (this.x != that.x) { return false; } /*&& y == ((ControlPoint) obj).y*/; return true;
if (obj == this) { return true; } if (!(obj instanceof XYLineAndShapeRenderer)) { return false; } XYStepRenderer that = (XYStepRenderer) obj; if (this.stepPoint != that.stepPoint) { return false; } return super.equals(obj);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYSplineRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYStepRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 9 Number of AST nodes: 8
1
if (obj == this) {
1
if (obj == this) {
2
                return true;
2
            return true;
3
            }
3
        }
4
            if (!(obj instanceof ControlPoint)) {
4
        if (!(obj instanceof XYLineAndShapeRenderer)) {
5
                return false;
5
            return false;
6
            }
6
        }
7
            ControlPoint that = (ControlPoint) obj;
7
        XYStepRenderer that = (XYStepRenderer) obj;
8
            if (this.x != that.x) {
8
        if (this.stepPoint != that.stepPoint) {
9
                return false;
9
            return false;
10
            }
10
        
11
            /*&& y == ((ControlPoint) obj).y*/;
12
            return true
11
}
13
;
12
        return 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)0.7
Clones locationClones are in different classes
Number of node comparisons24
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    3
    if (!(obj instanceof ControlPoint))
    3
    if (!(obj instanceof ControlPoint))
    3
    if (!(obj instanceof XYLineAndShapeRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPointorg.jfree.chart.renderer.xy.XYLineAndShapeRendererVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint does not match with type org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
    • Make classes org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint and org.jfree.chart.renderer.xy.XYLineAndShapeRenderer extend a common superclass
    3
    if (!(obj instanceof XYLineAndShapeRenderer))
    4
    return false;
    4
    return false;
                                                                                          
    5
    XYStepRenderer that = (XYStepRenderer)obj;
    5
    ControlPoint that = (ControlPoint)obj;
                                                                                  
    6
    if (this.x != that.x)
    6
    if (this.x != that.x)
    6
    if (this.stepPoint != that.stepPoint)
    Differences
    Expression1Expression2Difference
    xstepPointVARIABLE_NAME_MISMATCH
    floatdoubleVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPointorg.jfree.chart.renderer.xy.XYStepRendererVARIABLE_TYPE_MISMATCH
    xstepPointVARIABLE_NAME_MISMATCH
    floatdoubleVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type float of variable this.x does not match with type double of variable this.stepPoint
    Type float of variable that.x does not match with type double of variable that.stepPoint
    • Make classes org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint and org.jfree.chart.renderer.xy.XYStepRenderer extend a common superclass
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.stepPoint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type float of variable that.x does not match with type double of variable that.stepPoint
    6
    if (this.stepPoint != that.stepPoint)
    7
    return false;
    7
    return false;
    8
    ;
            
    9
    return true;
    9
    return true;
    8
    return super.equals(obj);
    Differences
    Expression1Expression2Difference
    truesuper.equals(obj)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call return super.equals(obj); cannot be extracted from method
    8
    return super.equals(obj);
    Precondition Violations (8)
    Row Violation
    1Type org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint does not match with type org.jfree.chart.renderer.xy.XYLineAndShapeRenderer
    2Type float of variable this.x does not match with type double of variable this.stepPoint
    3Type float of variable that.x does not match with type double of variable that.stepPoint
    4Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.stepPoint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type float of variable that.x does not match with type double of variable that.stepPoint
    7Super method call return super.equals(obj); cannot be extracted from method
    8The refactoring of the clones is infeasible, because classes org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint and org.jfree.chart.renderer.xy.XYStepRenderer do not have a common superclass