if (obj == this) { return true; } // now try to reject equality... if (!super.equals(obj)) { return false; } if (!(obj instanceof XYImageAnnotation)) { return false; } XYImageAnnotation that = (XYImageAnnotation) obj; if (this.x != that.x) { return false; } if (this.y != that.y) { return false; } if (!ObjectUtilities.equal(this.image, that.image)) { return false; } if (!this.anchor.equals(that.anchor)) { return false; } // seems to be the same... return true;
if (obj == null) { return false; } if (obj == this) { return true; } if (!(obj instanceof CombinedDomainXYPlot)) { return false; } if (!super.equals(obj)) { return false; } CombinedDomainXYPlot p = (CombinedDomainXYPlot) obj; if (this.totalWeight != p.totalWeight) { return false; } if (this.gap != p.gap) { return false; } if (!ObjectUtilities.equal(this.subplots, p.subplots)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYImageAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CombinedDomainXYPlot.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 16
1
if (obj == this) {
1
if (obj == null) {
2
            return true;
2
            return false;
3
        }
3
        }
4
        // now try to reject equality...
4
        
5
        if (!super.equals(obj
5
if (obj == this) {
6
            return true;
7
        }
6
)) {
8
        if (!(obj instanceof CombinedDomainXYPlot)) {
7
            return false;
9
            return false;
8
        }
10
        }
9
        if (!(obj instanceof XYImageAnnotation)) {
11
        if (!super.equals(obj)) {
10
            return false;
12
            return false;
11
        }
13
        }
12
        XYImageAnnotation that = (XYImageAnnotation) obj;
14
        CombinedDomainXYPlot p = (CombinedDomainXYPlot) obj;
13
        if (this.x != that.x) {
15
        if (this.totalWeight != p.totalWeight) {
14
            return false;
16
            return false;
15
        }
17
        }
16
        if (this.y != that.y) {
18
        if (this.gap != p.gap) {
17
            return false;
19
            return false;
18
        }
20
        }
19
        if (!ObjectUtilities.equal(this.image, that.image)) {
21
        if (!ObjectUtilities.equal(this.
20
            return false;
21
        }
22
        if (!this.anchor.equals(that.anchor)) {
22
subplots, p.subplots)) {
23
            return false;
23
            return false;
24
        }
24
        }
25
        // seems to be the same...
26
        return true;
25
        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)4.0
Clones locationClones are in different classes
Number of node comparisons80
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    3
    if (obj == this)
    2
    return true;
    4
    return true;
    3
    if (!super.equals(obj))
    3
    if (!super.equals(obj))
    7
    if (!super.equals(obj))
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    Super method call if(!super.equals(obj)) cannot be extracted from method
    7
    if (!super.equals(obj))
    4
    return false;
    8
    return false;
    5
    if (!(obj instanceof XYImageAnnotation))
    5
    if (!(obj instanceof XYImageAnnotation))
    5
    if (!(obj instanceof CombinedDomainXYPlot))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    5
    if (!(obj instanceof CombinedDomainXYPlot))
    6
    return false;
    6
    return false;
    7
    XYImageAnnotation that = (XYImageAnnotation)obj;
    7
    XYImageAnnotation that = (XYImageAnnotation)obj;
    9
    CombinedDomainXYPlot p = (CombinedDomainXYPlot)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    thatpVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    9
    CombinedDomainXYPlot p = (CombinedDomainXYPlot)obj;
    8
    if (this.x != that.x)
    8
    if (this.x != that.x)
    12
    if (this.gap != p.gap)
    Differences
    Expression1Expression2Difference
    xgapVARIABLE_NAME_MISMATCH
    thatpVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    xgapVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.gap 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
    Expression p.gap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (this.gap != p.gap)
    9
    return false;
    13
    return false;
    10
    if (this.y != that.y)
    10
    if (this.y != that.y)
    10
    if (this.totalWeight != p.totalWeight)
    Differences
    Expression1Expression2Difference
    ytotalWeightVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    thatpVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    ytotalWeightVARIABLE_NAME_MISMATCH
    doubleintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type double of variable this.y does not match with type int of variable this.totalWeight
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.totalWeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.totalWeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type double of variable that.y does not match with type int of variable p.totalWeight
    10
    if (this.totalWeight != p.totalWeight)
    11
    return false;
    11
    return false;
    12
    if (!ObjectUtilities.equal(this.image, that.image))
    12
    if (!ObjectUtilities.equal(this.image, that.image))
    14
    if (!ObjectUtilities.equal(this.subplots, p.subplots))
    Differences
    Expression1Expression2Difference
    imagesubplotsVARIABLE_NAME_MISMATCH
    java.awt.Imagejava.util.ListVARIABLE_TYPE_MISMATCH
    thatpVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYImageAnnotationorg.jfree.chart.plot.CombinedDomainXYPlotSUBCLASS_TYPE_MISMATCH
    imagesubplotsVARIABLE_NAME_MISMATCH
    java.awt.Imagejava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Image of variable this.image does not match with type java.util.List of variable this.subplots
    • Make classes java.awt.Image and java.util.List extend a common superclass
    Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.subplots cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.subplots cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Image of variable that.image does not match with type java.util.List of variable p.subplots
    • Make classes java.awt.Image and java.util.List extend a common superclass
    14
    if (!ObjectUtilities.equal(this.subplots, p.subplots))
    13
    return false;
    15
    return false;
    Precondition Violations (21)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Expression that.x cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression p.gap 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
    6Expression p.gap cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type double of variable this.y does not match with type int of variable this.totalWeight
    8Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression p.totalWeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression that.y cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression p.totalWeight cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type double of variable that.y does not match with type int of variable p.totalWeight
    13Type java.awt.Image of variable this.image does not match with type java.util.List of variable this.subplots
    14Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression p.subplots cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression p.subplots cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Type java.awt.Image of variable that.image does not match with type java.util.List of variable p.subplots
    19Clone fragment #1 returns variables that , while Clone fragment #2 returns variables
    20Not all possible execution flows end in a return statement
    21The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYImageAnnotation and org.jfree.chart.plot.CombinedDomainXYPlot do not have a common superclass