if (obj == this) { return true; } if (!(obj instanceof ChartRenderingInfo)) { return false; } ChartRenderingInfo that = (ChartRenderingInfo) obj; if (!ObjectUtilities.equal(this.chartArea, that.chartArea)) { return false; } if (!ObjectUtilities.equal(this.plotInfo, that.plotInfo)) { return false; } if (!ObjectUtilities.equal(this.entities, that.entities)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof ItemLabelPosition)) { return false; } ItemLabelPosition that = (ItemLabelPosition) obj; if (!this.itemLabelAnchor.equals(that.itemLabelAnchor)) { return false; } if (!this.textAnchor.equals(that.textAnchor)) { return false; } if (!this.rotationAnchor.equals(that.rotationAnchor)) { return false; } if (this.angle != that.angle) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartRenderingInfo.java File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/ItemLabelPosition.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 12 Number of AST nodes: 14
1
if (obj == this) {
1
if (obj == this) {
2
            return true;   
2
            return true;
3
        }
3
        }    
4
        if (!(obj instanceof ChartRenderingInfo)) {
4
        if (!(obj instanceof ItemLabelPosition)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        ChartRenderingInfo that = (ChartRenderingInfo) obj;
7
        ItemLabelPosition that = (ItemLabelPosition) obj;
8
        if (!ObjectUtilities.equal(this.chartArea, that.chartArea)) {
8
        if (!this.itemLabelAnchor.equals(that.itemLabelAnchor)) {
9
            return false;   
9
            return false;
10
        }
10
        }
11
        if (!ObjectUtilities.equal(this.plotInfo, that.plotInfo)) {
11
        if (!this.textAnchor.equals(that.textAnchor)) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (!ObjectUtilities.equal(this.entities, that.entities)
14
        if (!this.rotationAnchor.equals(that.rotationAnchor)) {
15
            return false;
16
        }
15
) {
17
        if (this.angle != that.angle) {
16
            return false;
18
            return false;
17
        }
19
        }     
18
        return true;
20
        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)1.5
Clones locationClones are in different classes
Number of node comparisons67
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)11.4
    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 ChartRenderingInfo))
    3
    if (!(obj instanceof ChartRenderingInfo))
    3
    if (!(obj instanceof ItemLabelPosition))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.ChartRenderingInfoorg.jfree.chart.labels.ItemLabelPositionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.ChartRenderingInfo does not match with type org.jfree.chart.labels.ItemLabelPosition
    • Make classes org.jfree.chart.ChartRenderingInfo and org.jfree.chart.labels.ItemLabelPosition extend a common superclass
    3
    if (!(obj instanceof ItemLabelPosition))
    4
    return false;
    4
    return false;
                                                                                                      
    5
    ItemLabelPosition that = (ItemLabelPosition)obj;
    5
    ChartRenderingInfo that = (ChartRenderingInfo)obj;
                                                                                                          
    6
    if (!ObjectUtilities.equal(this.chartArea, that.chartArea))
    6
    if (!ObjectUtilities.equal(this.chartArea, that.chartArea))
    6
    if (!this.itemLabelAnchor.equals(that.itemLabelAnchor))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.chartArea,that.chartArea)this.itemLabelAnchor.equals(that.itemLabelAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.chartArea,that.chartArea) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.itemLabelAnchor.equals(that.itemLabelAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!this.itemLabelAnchor.equals(that.itemLabelAnchor))
    7
    return false;
    7
    return false;
    8
    if (!ObjectUtilities.equal(this.plotInfo, that.plotInfo))
    8
    if (!ObjectUtilities.equal(this.plotInfo, that.plotInfo))
    8
    if (!this.textAnchor.equals(that.textAnchor))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.plotInfo,that.plotInfo)this.textAnchor.equals(that.textAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.plotInfo,that.plotInfo) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.textAnchor.equals(that.textAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!this.textAnchor.equals(that.textAnchor))
    9
    return false;
    9
    return false;
    10
    if (!ObjectUtilities.equal(this.entities, that.entities))
    10
    if (!ObjectUtilities.equal(this.entities, that.entities))
    10
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    Differences
    Expression1Expression2Difference
    ObjectUtilities.equal(this.entities,that.entities)this.rotationAnchor.equals(that.rotationAnchor)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ObjectUtilities.equal(this.entities,that.entities) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.rotationAnchor.equals(that.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!this.rotationAnchor.equals(that.rotationAnchor))
    11
    return false;
    11
    return false;
    12
    return true;
    14
    return true;
    Precondition Violations (8)
    Row Violation
    1Type org.jfree.chart.ChartRenderingInfo does not match with type org.jfree.chart.labels.ItemLabelPosition
    2Expression ObjectUtilities.equal(this.chartArea,that.chartArea) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression this.itemLabelAnchor.equals(that.itemLabelAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression ObjectUtilities.equal(this.plotInfo,that.plotInfo) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression this.textAnchor.equals(that.textAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression ObjectUtilities.equal(this.entities,that.entities) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression this.rotationAnchor.equals(that.rotationAnchor) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Not all possible execution flows end in a return statement