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 AbstractPieItemLabelGenerator)) { return false; } AbstractPieItemLabelGenerator that = (AbstractPieItemLabelGenerator) obj; if (!this.labelFormat.equals(that.labelFormat)) { return false; } if (!this.numberFormat.equals(that.numberFormat)) { return false; } if (!this.percentFormat.equals(that.percentFormat)) { 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/chart/labels/AbstractPieItemLabelGenerator.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 AbstractPieItemLabelGenerator)) {
5
            return false;   
5
            return false;
6
        }
7
        if (!super.equals(obj
6
        }
7
        AbstractPieItemLabelGenerator that
8
                = (AbstractPieItemLabelGenerator) obj;
8
)) {
9
        if (!this.labelFormat.equals(that.labelFormat)) {
9
            return false;   
10
            return false;
10
        }
11
        }
11
        BlockContainer that = (BlockContainer) obj;
12
        
12
        if (!this.arrangement.equals(that.arrangement)) {
13
if (!this.numberFormat.equals(that.numberFormat)) {
13
            return false;   
14
            return false;
14
        }
15
        }
15
        if (!this.blocks.equals(that.blocks)) {
16
        if (!this.percentFormat.equals(that.percentFormat)) {
16
            return false;   
17
            return false;
17
        }
18
        }
18
        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)2.2
Clones locationClones are in different classes
Number of node comparisons62
  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.5
    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 BlockContainer))
    3
    if (!(obj instanceof BlockContainer))
    3
    if (!(obj instanceof AbstractPieItemLabelGenerator))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.BlockContainerorg.jfree.chart.labels.AbstractPieItemLabelGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.block.BlockContainer does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator
    • Make classes org.jfree.chart.block.BlockContainer and org.jfree.chart.labels.AbstractPieItemLabelGenerator extend a common superclass
    3
    if (!(obj instanceof AbstractPieItemLabelGenerator))
    4
    return false;
    4
    return false;
                                                                                                                                                      
    5
    AbstractPieItemLabelGenerator that = (AbstractPieItemLabelGenerator)obj;
    5
    if (!super.equals(obj))
    5
    if (!super.equals(obj))
    6
    if (!this.labelFormat.equals(that.labelFormat))
    Differences
    Expression1Expression2Difference
    super.equals(obj)this.labelFormat.equals(that.labelFormat)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.labelFormat.equals(that.labelFormat) 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.labelFormat.equals(that.labelFormat))
    6
    return false;
    7
    return false;
    7
    BlockContainer that = (BlockContainer)obj;
                                                                                          
    8
    if (!this.arrangement.equals(that.arrangement))
    8
    if (!this.arrangement.equals(that.arrangement))
    8
    if (!this.numberFormat.equals(that.numberFormat))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.BlockContainerorg.jfree.chart.labels.AbstractPieItemLabelGeneratorVARIABLE_TYPE_MISMATCH
    arrangementnumberFormatVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Arrangementjava.text.NumberFormatVARIABLE_TYPE_MISMATCH
    arrangementnumberFormatVARIABLE_NAME_MISMATCH
    org.jfree.chart.block.Arrangementjava.text.NumberFormatVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.block.Arrangement of variable that.arrangement does not match with type java.text.NumberFormat of variable that.numberFormat
    • Make classes org.jfree.chart.block.BlockContainer and org.jfree.chart.labels.AbstractPieItemLabelGenerator extend a common superclass
    Expression that.arrangement cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.numberFormat 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.text.NumberFormat of variable that.numberFormat
    • Make classes org.jfree.chart.block.Arrangement and java.text.NumberFormat extend a common superclass
    Type org.jfree.chart.block.Arrangement of variable this.arrangement does not match with type java.text.NumberFormat of variable this.numberFormat
    • Make classes org.jfree.chart.block.Arrangement and java.text.NumberFormat extend a common superclass
    8
    if (!this.numberFormat.equals(that.numberFormat))
    9
    return false;
    9
    return false;
    10
    if (!this.blocks.equals(that.blocks))
    10
    if (!this.blocks.equals(that.blocks))
    10
    if (!this.percentFormat.equals(that.percentFormat))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.BlockContainerorg.jfree.chart.labels.AbstractPieItemLabelGeneratorVARIABLE_TYPE_MISMATCH
    blockspercentFormatVARIABLE_NAME_MISMATCH
    java.util.Listjava.text.NumberFormatVARIABLE_TYPE_MISMATCH
    blockspercentFormatVARIABLE_NAME_MISMATCH
    java.util.Listjava.text.NumberFormatVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable that.blocks does not match with type java.text.NumberFormat of variable that.percentFormat
    • Make classes org.jfree.chart.block.BlockContainer and org.jfree.chart.labels.AbstractPieItemLabelGenerator extend a common superclass
    Expression that.blocks cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.percentFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.List of variable that.blocks does not match with type java.text.NumberFormat of variable that.percentFormat
    • Make classes java.util.List and java.text.NumberFormat extend a common superclass
    Type java.util.List of variable this.blocks does not match with type java.text.NumberFormat of variable this.percentFormat
    • Make classes java.util.List and java.text.NumberFormat extend a common superclass
    10
    if (!this.percentFormat.equals(that.percentFormat))
    11
    return false;
    11
    return false;
    12
    return true;
    12
    return true;
    Precondition Violations (14)
    Row Violation
    1Type org.jfree.chart.block.BlockContainer does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator
    2Expression this.labelFormat.equals(that.labelFormat) 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 org.jfree.chart.block.Arrangement of variable that.arrangement does not match with type java.text.NumberFormat of variable that.numberFormat
    5Expression that.arrangement cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression that.numberFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type org.jfree.chart.block.Arrangement of variable that.arrangement does not match with type java.text.NumberFormat of variable that.numberFormat
    8Type org.jfree.chart.block.Arrangement of variable this.arrangement does not match with type java.text.NumberFormat of variable this.numberFormat
    9Type java.util.List of variable that.blocks does not match with type java.text.NumberFormat of variable that.percentFormat
    10Expression that.blocks cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.percentFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.util.List of variable that.blocks does not match with type java.text.NumberFormat of variable that.percentFormat
    13Type java.util.List of variable this.blocks does not match with type java.text.NumberFormat of variable this.percentFormat
    14The refactoring of the clones is infeasible, because classes org.jfree.chart.block.BlockContainer and org.jfree.chart.labels.AbstractPieItemLabelGenerator do not have a common superclass