if (obj == this) { return true; } if (!(obj instanceof XYBlockRenderer)) { return false; } XYBlockRenderer that = (XYBlockRenderer) obj; if (this.blockHeight != that.blockHeight) { return false; } if (this.blockWidth != that.blockWidth) { return false; } if (!this.blockAnchor.equals(that.blockAnchor)) { return false; } if (!this.paintScale.equals(that.paintScale)) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof Title)) { return false; } if (!super.equals(obj)) { return false; } Title that = (Title) obj; if (this.position != that.position) { return false; } if (this.horizontalAlignment != that.horizontalAlignment) { return false; } if (this.verticalAlignment != that.verticalAlignment) { return false; } if (this.notify != that.notify) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBlockRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/Title.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 14 Number of AST nodes: 16
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof XYBlockRenderer)) {
4
        if (!(obj instanceof Title)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        XYBlockRenderer that = (XYBlockRenderer
7
        if (!super.equals(obj)) {
8
            return false;   
9
        }
8
) obj;
10
        Title that = (Title) obj;
9
        if (this.blockHeight != that.blockHeight) {
11
        if (this.position != that.position) {
10
            return false;
12
            return false;
11
        }
13
        }
12
        if (this.blockWidth != that.blockWidth) {
14
        if (this.horizontalAlignment != that.horizontalAlignment) {
13
            return false;
15
            return false;
14
        }
16
        }
15
        if (!this.blockAnchor.equals(that.blockAnchor)) {
17
        if (this.verticalAlignment != that.verticalAlignment) {
16
            return false;
18
            return false;
17
        }
19
        }
18
        if (!this.paintScale.equals(that.paintScale)) {
20
        if (this.notify != that.notify) {
19
            return false;
21
            return false;
20
        }
22
        }
21
        return super.equals(obj);
23
        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)3.3
Clones locationClones are in different classes
Number of node comparisons64
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements10
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    3
    if (!(obj instanceof XYBlockRenderer))
    3
    if (!(obj instanceof XYBlockRenderer))
    3
    if (!(obj instanceof Title))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.chart.title.TitleVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.xy.XYBlockRenderer does not match with type org.jfree.chart.title.Title
    • Make classes org.jfree.chart.renderer.xy.XYBlockRenderer and org.jfree.chart.title.Title extend a common superclass
    3
    if (!(obj instanceof Title))
    4
    return false;
    4
    return false;
    5
    XYBlockRenderer that = (XYBlockRenderer)obj;
                                                                                              
                                                      
    7
    Title that = (Title)obj;
    6
    if (this.blockHeight != that.blockHeight)
    6
    if (this.blockHeight != that.blockHeight)
    8
    if (this.position != that.position)
    Differences
    Expression1Expression2Difference
    blockHeightpositionVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleEdgeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.chart.title.TitleVARIABLE_TYPE_MISMATCH
    blockHeightpositionVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.RectangleEdgeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.blockHeight does not match with type org.jfree.ui.RectangleEdge of variable this.position
    Type double of variable that.blockHeight does not match with type org.jfree.ui.RectangleEdge of variable that.position
    • Make classes org.jfree.chart.renderer.xy.XYBlockRenderer and org.jfree.chart.title.Title extend a common superclass
    Expression that.blockHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.blockHeight does not match with type org.jfree.ui.RectangleEdge of variable that.position
    8
    if (this.position != that.position)
    7
    return false;
    9
    return false;
    8
    if (this.blockWidth != that.blockWidth)
    8
    if (this.blockWidth != that.blockWidth)
    10
    if (this.horizontalAlignment != that.horizontalAlignment)
    Differences
    Expression1Expression2Difference
    blockWidthhorizontalAlignmentVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.HorizontalAlignmentVARIABLE_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.chart.title.TitleVARIABLE_TYPE_MISMATCH
    blockWidthhorizontalAlignmentVARIABLE_NAME_MISMATCH
    doubleorg.jfree.ui.HorizontalAlignmentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.blockWidth does not match with type org.jfree.ui.HorizontalAlignment of variable this.horizontalAlignment
    Type double of variable that.blockWidth does not match with type org.jfree.ui.HorizontalAlignment of variable that.horizontalAlignment
    • Make classes org.jfree.chart.renderer.xy.XYBlockRenderer and org.jfree.chart.title.Title extend a common superclass
    Expression that.blockWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.horizontalAlignment cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.blockWidth does not match with type org.jfree.ui.HorizontalAlignment of variable that.horizontalAlignment
    10
    if (this.horizontalAlignment != that.horizontalAlignment)
    9
    return false;
    11
    return false;
    10
    if (!this.blockAnchor.equals(that.blockAnchor))
    10
    if (!this.blockAnchor.equals(that.blockAnchor))
    5
    if (!super.equals(obj))
    Differences
    Expression1Expression2Difference
    this.blockAnchor.equals(that.blockAnchor)super.equals(obj)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.blockAnchor.equals(that.blockAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Super method call if(!super.equals(obj)) cannot be extracted from method
    5
    if (!super.equals(obj))
    11
    return false;
    6
    return false;
    Precondition Violations (15)
    Row Violation
    1Type org.jfree.chart.renderer.xy.XYBlockRenderer does not match with type org.jfree.chart.title.Title
    2Type double of variable this.blockHeight does not match with type org.jfree.ui.RectangleEdge of variable this.position
    3Type double of variable that.blockHeight does not match with type org.jfree.ui.RectangleEdge of variable that.position
    4Expression that.blockHeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.position cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type double of variable that.blockHeight does not match with type org.jfree.ui.RectangleEdge of variable that.position
    7Type double of variable this.blockWidth does not match with type org.jfree.ui.HorizontalAlignment of variable this.horizontalAlignment
    8Type double of variable that.blockWidth does not match with type org.jfree.ui.HorizontalAlignment of variable that.horizontalAlignment
    9Expression that.blockWidth cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.horizontalAlignment cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Type double of variable that.blockWidth does not match with type org.jfree.ui.HorizontalAlignment of variable that.horizontalAlignment
    12Expression this.blockAnchor.equals(that.blockAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Super method call if(!super.equals(obj)) cannot be extracted from method
    14Not all possible execution flows end in a return statement
    15The refactoring of the clones is infeasible, because classes org.jfree.chart.renderer.xy.XYBlockRenderer and org.jfree.chart.title.Title do not have a common superclass