if (obj == this) { return true; } if (!(obj instanceof BlockContainer)) { return false; } if (!super.equals(obj)) { return false; } BlockContainer that = (BlockContainer) obj; if (!this.arrangement.equals(that.arrangement)) { return false; } if (!this.blocks.equals(that.blocks)) { 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/block/BlockContainer.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 == this) {
1
if (obj == this) {
2
            return true;   
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof BlockContainer)) {
4
        if (!(obj instanceof SimpleHistogramDataset)) {
5
            return false;
5
            return false;
6
   
6
        }
7
        }
7
        
8
        if (!super.equals(obj
8
SimpleHistogramDataset that = (SimpleHistogramDataset) obj;
9
)) {
9
        if (!this.key.equals(that.key)) {
10
            return false;   
10
            return false;
11
        }
11
        }
12
        BlockContainer that = (BlockContainer) obj;
12
        
13
        if (!this.arrangement.equals(that.arrangement)) {
13
if (this.adjustForBinSize != that.adjustForBinSize) {
14
            return false;   
14
            return false;
15
        }
15
        }
16
        if (!this.blocks.equals(that.blocks)) {
16
        if (!this.bins.equals(that.bins)) {
17
            return false;   
17
            return false;
18
        }
18
        }
19
        return true;
19
        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.8
Clones locationClones are in different classes
Number of node comparisons47
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)5.1
    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 BlockContainer))
    3
    if (!(obj instanceof BlockContainer))
    3
    if (!(obj instanceof SimpleHistogramDataset))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.BlockContainerorg.jfree.data.statistics.SimpleHistogramDatasetSUBCLASS_TYPE_MISMATCH
    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
    BlockContainer that = (BlockContainer)obj;
                                                                                          
                                                                                                              
    8
    if (this.adjustForBinSize != that.adjustForBinSize)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    8
    if (!this.arrangement.equals(that.arrangement))
    8
    if (!this.arrangement.equals(that.arrangement))
    10
    if (!this.bins.equals(that.bins))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.BlockContainerorg.jfree.data.statistics.SimpleHistogramDatasetSUBCLASS_TYPE_MISMATCH
    arrangementbinsVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Arrangementjava.util.ListVARIABLE_TYPE_MISMATCH
    arrangementbinsVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Arrangementjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression that.arrangement 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 org.jfree.chart.block.Arrangement of variable that.arrangement does not match with type java.util.List of variable that.bins
    • Make classes org.jfree.chart.block.Arrangement and java.util.List extend a common superclass
    Type org.jfree.chart.block.Arrangement of variable this.arrangement does not match with type java.util.List of variable this.bins
    • Make classes org.jfree.chart.block.Arrangement and java.util.List extend a common superclass
    10
    if (!this.bins.equals(that.bins))
    9
    return false;
    11
    return false;
    Precondition Violations (9)
    Row Violation
    1Expression this.key.equals(that.key) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Unmatched return false;
    4Expression that.arrangement cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression that.bins cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type org.jfree.chart.block.Arrangement of variable that.arrangement does not match with type java.util.List of variable that.bins
    7Type org.jfree.chart.block.Arrangement of variable this.arrangement does not match with type java.util.List of variable this.bins
    8Not all possible execution flows end in a return statement
    9The refactoring of the clones is infeasible, because classes org.jfree.chart.block.BlockContainer and org.jfree.data.statistics.SimpleHistogramDataset do not have a common superclass