if (obj == this) { return true; } if (!(obj instanceof StackedBarRenderer)) { return false; } StackedBarRenderer that = (StackedBarRenderer) obj; if (this.renderAsPercentages != that.renderAsPercentages) { return false; } return super.equals(obj);
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;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StackedBarRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYSplineRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 8 Number of AST nodes: 9
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
                return true;
3
        }
3
            }
4
        if (!(obj instanceof StackedBarRenderer)) {
4
            if (!(obj instanceof ControlPoint)) {
5
            return false;
5
                return false;
6
        }
6
        
7
        StackedBarRenderer that = (StackedBarRenderer
7
    }
8
) obj;
8
            ControlPoint that = (ControlPoint) obj;
9
        if (this.renderAsPercentages != that.renderAsPercentages) {
9
            if (this.x != that.x) {
10
            return false;
10
                return false;
11
        }
11
        
12
        return super.equals(obj)
12
    }
13
            /*&& y == ((ControlPoint) obj).y*/;
13
;
14
            return true;
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 fragment1
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.7
    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 StackedBarRenderer))
    3
    if (!(obj instanceof StackedBarRenderer))
    3
    if (!(obj instanceof ControlPoint))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.category.StackedBarRendererorg.jfree.chart.renderer.xy.XYSplineRenderer.ControlPointVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.category.StackedBarRenderer does not match with type org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint
    • Make classes org.jfree.chart.renderer.category.StackedBarRenderer and org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint extend a common superclass
    3
    if (!(obj instanceof ControlPoint))
    4
    return false;
    4
    return false;
                                                                                  
    5
    ControlPoint that = (ControlPoint)obj;
    5
    StackedBarRenderer that = (StackedBarRenderer)obj;
                                                                                                          
    6
    if (this.renderAsPercentages != that.renderAsPercentages)
    6
    if (this.renderAsPercentages != that.renderAsPercentages)
    6
    if (this.x != that.x)
    Differences
    Expression1Expression2Difference
    renderAsPercentagesxVARIABLE_NAME_MISMATCH
    booleanfloatVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.category.StackedBarRendererorg.jfree.chart.renderer.xy.XYSplineRenderer.ControlPointVARIABLE_TYPE_MISMATCH
    renderAsPercentagesxVARIABLE_NAME_MISMATCH
    booleanfloatVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type boolean of variable this.renderAsPercentages does not match with type float of variable this.x
    Type boolean of variable that.renderAsPercentages does not match with type float of variable that.x
    • Make classes org.jfree.chart.renderer.category.StackedBarRenderer and org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint extend a common superclass
    Expression that.renderAsPercentages cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type boolean of variable that.renderAsPercentages does not match with type float of variable that.x
    6
    if (this.x != that.x)
    7
    return false;
    7
    return false;
            
    8
    ;
    8
    return super.equals(obj);
    8
    return super.equals(obj);
    9
    return true;
    Differences
    Expression1Expression2Difference
    super.equals(obj)trueTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Super method call return super.equals(obj); cannot be extracted from method
    9
    return true;
    Precondition Violations (8)
    Row Violation
    1Type org.jfree.chart.renderer.category.StackedBarRenderer does not match with type org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint
    2Type boolean of variable this.renderAsPercentages does not match with type float of variable this.x
    3Type boolean of variable that.renderAsPercentages does not match with type float of variable that.x
    4Expression that.renderAsPercentages cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type boolean of variable that.renderAsPercentages does not match with type float of variable that.x
    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.category.StackedBarRenderer and org.jfree.chart.renderer.xy.XYSplineRenderer.ControlPoint do not have a common superclass