if (obj == this) { return true; } if (!(obj instanceof CategoryLineAnnotation)) { return false; } CategoryLineAnnotation that = (CategoryLineAnnotation) obj; if (!this.category1.equals(that.getCategory1())) { return false; } if (this.value1 != that.getValue1()) { return false; } if (!this.category2.equals(that.getCategory2())) { return false; } if (this.value2 != that.getValue2()) { return false; } if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof BorderArrangement)) { return false; } BorderArrangement that = (BorderArrangement) obj; if (!ObjectUtilities.equal(this.topBlock, that.topBlock)) { return false; } if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock)) { return false; } if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock)) { return false; } if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock)) { return false; } if (!ObjectUtilities.equal(this.centerBlock, that.centerBlock)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/CategoryLineAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/block/BorderArrangement.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 18 Number of AST nodes: 16
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof CategoryLineAnnotation)) {
4
        if (!(obj instanceof BorderArrangement)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        CategoryLineAnnotation that = (CategoryLineAnnotation) obj;
7
        BorderArrangement that = (BorderArrangement) obj;
8
        if (!this.category1.equals(that.getCategory1())) {
8
        if (!ObjectUtilities.equal(this.topBlock, that.topBlock)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        if (this.value1 != that.getValue1()) {
11
        if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock)) {
12
            return false;
12
            return false;
13
        }
13
        }
14
        if (!this.category2.equals(that.getCategory2())) {
14
        if (!ObjectUtilities.equal(th
15
            return false;
16
        }
17
        if (this.value2 != that.getValue2()) {
15
is.leftBlock, that.leftBlock)) {
18
            return false;
16
            return false;
19
        }
17
        }
20
        if (!PaintUtilities.equal(this.paint, that.paint)) {
18
        if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock)) {
21
            return false;
19
            return false;
22
        }
20
        }
23
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
21
        if (!ObjectUtilities.equal(this.centerBlock, that.centerBlock)) {
24
            return false;
22
            return false;
25
        }
23
        }
26
        return true;
24
        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.5
Clones locationClones are in different classes
Number of node comparisons105
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.5
    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 CategoryLineAnnotation))
    3
    if (!(obj instanceof CategoryLineAnnotation))
    3
    if (!(obj instanceof BorderArrangement))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.block.BorderArrangementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.annotations.CategoryLineAnnotation does not match with type org.jfree.chart.block.BorderArrangement
    • Make classes org.jfree.chart.annotations.CategoryLineAnnotation and org.jfree.chart.block.BorderArrangement extend a common superclass
    3
    if (!(obj instanceof BorderArrangement))
    4
    return false;
    4
    return false;
                                                                                                      
    5
    BorderArrangement that = (BorderArrangement)obj;
    5
    CategoryLineAnnotation that = (CategoryLineAnnotation)obj;
                                                                                                                          
    6
    if (!this.category1.equals(that.getCategory1()))
    6
    if (!this.category1.equals(that.getCategory1()))
    6
    if (!ObjectUtilities.equal(this.topBlock, that.topBlock))
    Differences
    Expression1Expression2Difference
    this.category1.equals(that.getCategory1())ObjectUtilities.equal(this.topBlock,that.topBlock)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.category1.equals(that.getCategory1()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.topBlock,that.topBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6
    if (!ObjectUtilities.equal(this.topBlock, that.topBlock))
    7
    return false;
    7
    return false;
    8
    if (this.value1 != that.getValue1())
                                                                                
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (!this.category2.equals(that.getCategory2()))
    10
    if (!this.category2.equals(that.getCategory2()))
    10
    if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock))
    Differences
    Expression1Expression2Difference
    this.category2.equals(that.getCategory2())ObjectUtilities.equal(this.leftBlock,that.leftBlock)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.category2.equals(that.getCategory2()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ObjectUtilities.equal(this.leftBlock,that.leftBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!ObjectUtilities.equal(this.leftBlock, that.leftBlock))
    11
    return false;
    11
    return false;
    12
    if (this.value2 != that.getValue2())
                                                                                  
    13
    return false;
    13
    return false;
    Preondition Violations
    Unmatched return false;
                                      
    14
    if (!PaintUtilities.equal(this.paint, that.paint))
    14
    if (!PaintUtilities.equal(this.paint, that.paint))
    12
    if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock))
    Differences
    Expression1Expression2Difference
    paintrightBlockVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.block.BlockVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.block.BorderArrangementVARIABLE_TYPE_MISMATCH
    paintrightBlockVARIABLE_NAME_MISMATCH
    java.awt.Paintorg.jfree.chart.block.BlockVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.paint does not match with type org.jfree.chart.block.Block of variable this.rightBlock
    • Make classes java.awt.Paint and org.jfree.chart.block.Block extend a common superclass
    Type java.awt.Paint of variable that.paint does not match with type org.jfree.chart.block.Block of variable that.rightBlock
    • Make classes org.jfree.chart.annotations.CategoryLineAnnotation and org.jfree.chart.block.BorderArrangement extend a common superclass
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.rightBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.paint does not match with type org.jfree.chart.block.Block of variable that.rightBlock
    • Make classes java.awt.Paint and org.jfree.chart.block.Block extend a common superclass
    Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    • Make classes org.jfree.util.PaintUtilities and org.jfree.util.ObjectUtilities extend a common superclass
    12
    if (!ObjectUtilities.equal(this.rightBlock, that.rightBlock))
    15
    return false;
    13
    return false;
    16
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    16
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    8
    if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock))
    Differences
    Expression1Expression2Difference
    strokebottomBlockVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.block.BlockVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.block.BorderArrangementVARIABLE_TYPE_MISMATCH
    strokebottomBlockVARIABLE_NAME_MISMATCH
    java.awt.Strokeorg.jfree.chart.block.BlockVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.block.Block of variable this.bottomBlock
    • Make classes java.awt.Stroke and org.jfree.chart.block.Block extend a common superclass
    Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.block.Block of variable that.bottomBlock
    • Make classes org.jfree.chart.annotations.CategoryLineAnnotation and org.jfree.chart.block.BorderArrangement extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.bottomBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.block.Block of variable that.bottomBlock
    • Make classes java.awt.Stroke and org.jfree.chart.block.Block extend a common superclass
    8
    if (!ObjectUtilities.equal(this.bottomBlock, that.bottomBlock))
    17
    return false;
    9
    return false;
    Precondition Violations (19)
    Row Violation
    1Type org.jfree.chart.annotations.CategoryLineAnnotation does not match with type org.jfree.chart.block.BorderArrangement
    2Expression this.category1.equals(that.getCategory1()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ObjectUtilities.equal(this.topBlock,that.topBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Expression this.category2.equals(that.getCategory2()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression ObjectUtilities.equal(this.leftBlock,that.leftBlock) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Unmatched return false;
    8Type java.awt.Paint of variable this.paint does not match with type org.jfree.chart.block.Block of variable this.rightBlock
    9Type java.awt.Paint of variable that.paint does not match with type org.jfree.chart.block.Block of variable that.rightBlock
    10Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.rightBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Paint of variable that.paint does not match with type org.jfree.chart.block.Block of variable that.rightBlock
    13Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    14Type java.awt.Stroke of variable this.stroke does not match with type org.jfree.chart.block.Block of variable this.bottomBlock
    15Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.block.Block of variable that.bottomBlock
    16Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression that.bottomBlock cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Type java.awt.Stroke of variable that.stroke does not match with type org.jfree.chart.block.Block of variable that.bottomBlock
    19Not all possible execution flows end in a return statement