if (obj == null) { return false; } if (!(obj instanceof CategoryMarker)) { return false; } if (!super.equals(obj)) { return false; } CategoryMarker that = (CategoryMarker) obj; if (!this.key.equals(that.key)) { return false; } if (this.drawAsLine != that.drawAsLine) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof SimpleHistogramDataset)) { return false; } SimpleHistogramDataset that = (SimpleHistogramDataset) obj; if (!this.key.equals(that.key)) { return false; } if (this.adjustForBinSize != that.adjustForBinSize) { return false; } if (!this.bins.equals(that.bins)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/CategoryMarker.java File path: /jfreechart-1.0.10/src/org/jfree/data/statistics/SimpleHistogramDataset.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (obj == null) {
1
if (obj == this) {
2
            return false;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof CategoryMarker)) {
4
        if (!(obj instanceof SimpleHistogramDataset)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        if (!super.equals(obj)) {
7
        
8
            return false;
9
        }
10
        CategoryMarker that = (CategoryMarker) obj;
11
        if (!this.key.equals(that.key)
8
SimpleHistogramDataset that = (SimpleHistogramDataset) obj;
9
        if (!this.key.equals(that.key)) {
10
            return false;
11
        }
12
) {
12
        if (this.adjustForBinSize != that.adjustForBinSize) {
13
            return false;
13
            return false;
14
        }
14
        }
15
        if (this.drawAsLine != that.drawAsLine) {
15
        if (!this.bins.equals(that.bins)) {
16
            return false;
16
            return false;
17
        }
17
        }
18
        return true;
18
        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)2.0
Clones locationClones are in different classes
Number of node comparisons53
  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)2.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == null)
    1
    if (obj == null)
    1
    if (obj == this)
    Differences
    Expression1Expression2Difference
    nullthisTYPE_COMPATIBLE_REPLACEMENT
    1
    if (obj == this)
    2
    return false;
    2
    return false;
    2
    return true;
    Differences
    Expression1Expression2Difference
    falsetrueLITERAL_VALUE_MISMATCH
    2
    return true;
    3
    if (!(obj instanceof CategoryMarker))
    3
    if (!(obj instanceof CategoryMarker))
    3
    if (!(obj instanceof SimpleHistogramDataset))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.data.statistics.SimpleHistogramDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.plot.CategoryMarker does not match with type org.jfree.data.statistics.SimpleHistogramDataset
    • Make classes org.jfree.chart.plot.CategoryMarker and org.jfree.data.statistics.SimpleHistogramDataset extend a common superclass
    3
    if (!(obj instanceof SimpleHistogramDataset))
    4
    return false;
    4
    return false;
                                                                                                                          
    5
    SimpleHistogramDataset that = (SimpleHistogramDataset)obj;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    6
    if (!this.key.equals(that.key))
    Differences
    Expression1Expression2Difference
    super.equals(obj)this.key.equals(that.key)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.key.equals(that.key) 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
    6
    if (!this.key.equals(that.key))
    6
    return false;
    7
    return false;
    7
    CategoryMarker that = (CategoryMarker)obj;
                                                                                          
    8
    if (!this.key.equals(that.key))
    8
    if (!this.key.equals(that.key))
    10
    if (!this.bins.equals(that.bins))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CategoryMarkerorg.jfree.data.statistics.SimpleHistogramDatasetVARIABLE_TYPE_MISMATCH
    keybinsVARIABLE_NAME_MISMATCH
    java.lang.Comparablejava.util.ListVARIABLE_TYPE_MISMATCH
    keybinsVARIABLE_NAME_MISMATCH
    java.lang.Comparablejava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Comparable of variable that.key does not match with type java.util.List of variable that.bins
    • Make classes org.jfree.chart.plot.CategoryMarker and org.jfree.data.statistics.SimpleHistogramDataset extend a common superclass
    Expression that.key cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.bins cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.lang.Comparable of variable that.key does not match with type java.util.List of variable that.bins
    • Make classes java.lang.Comparable and java.util.List extend a common superclass
    Type java.lang.Comparable of variable this.key does not match with type java.util.List of variable this.bins
    • Make classes java.lang.Comparable and java.util.List extend a common superclass
    10
    if (!this.bins.equals(that.bins))
    9
    return false;
    11
    return false;
    10
    if (this.drawAsLine != that.drawAsLine)
    10
    if (this.drawAsLine != that.drawAsLine)
    8
    if (this.adjustForBinSize != that.adjustForBinSize)
    Differences
    Expression1Expression2Difference
    drawAsLineadjustForBinSizeVARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.CategoryMarkerorg.jfree.data.statistics.SimpleHistogramDatasetVARIABLE_TYPE_MISMATCH
    drawAsLineadjustForBinSizeVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type boolean of variable that.drawAsLine does not match with type boolean of variable that.adjustForBinSize
    • Make classes org.jfree.chart.plot.CategoryMarker and org.jfree.data.statistics.SimpleHistogramDataset extend a common superclass
    Expression that.drawAsLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.adjustForBinSize cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (this.adjustForBinSize != that.adjustForBinSize)
    11
    return false;
    9
    return false;
    12
    return true;
    12
    return true;
    Precondition Violations (11)
    Row Violation
    1Type org.jfree.chart.plot.CategoryMarker does not match with type org.jfree.data.statistics.SimpleHistogramDataset
    2Expression this.key.equals(that.key) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Super method call if(!super.equals(obj)) cannot be extracted from method
    4Type java.lang.Comparable of variable that.key does not match with type java.util.List of variable that.bins
    5Expression that.key cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.bins cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type java.lang.Comparable of variable that.key does not match with type java.util.List of variable that.bins
    8Type java.lang.Comparable of variable this.key does not match with type java.util.List of variable this.bins
    9Type boolean of variable that.drawAsLine does not match with type boolean of variable that.adjustForBinSize
    10Expression that.drawAsLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.adjustForBinSize cannot be parameterized, because it has dependencies to/from statements that will be extracted