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 XYDifferenceRenderer)) { return false; } if (!super.equals(obj)) { return false; } XYDifferenceRenderer that = (XYDifferenceRenderer) obj; if (!PaintUtilities.equal(this.positivePaint, that.positivePaint)) { return false; } if (!PaintUtilities.equal(this.negativePaint, that.negativePaint)) { return false; } if (this.shapesVisible != that.shapesVisible) { return false; } if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) { return false; } if (this.roundXCoordinates != that.roundXCoordinates) { 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/renderer/xy/XYDifferenceRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 18 Number of AST nodes: 18
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 XYDifferenceRenderer)) {
5
            return false;
5
            return false;
6
        }
6
   
7
        CategoryLineAnnotation that = (CategoryLineAnnotation) obj;
7
        
8
        if (!this.category1.equals(that.getCategory1()
8
}
9
)) {
9
        if (!super.equals(obj)) {
10
            return false;
10
            return false;   
11
        }
11
        }
12
        if (this.value1 != that.getValue1(
12
        XYDifferenceRenderer that = (XYDifferenceRenderer) obj;
13
)) {
13
        if (!PaintUtilities.equal(this.positivePaint, that.positivePaint)) {
14
            return false;
14
            return false;   
15
        }
15
        }
16
        if (!this.category2.equals(that.getCategory2())) {
16
        if (!PaintUtilities.equal(this.negativePaint, that.negativePaint)) {
17
            return false;
17
            return false;   
18
        }
18
        }
19
        if (this.value2 != that.getValue2()) {
19
        if (this.shapesVisible != that.shapesVisible) {
20
            return false;
20
            return false;   
21
        }
21
        }
22
        if (!PaintUtilities.equal(this.paint, that.paint)) {
22
        if (!ShapeUtilities.equal(this.legendLine, that.legendLine)) {
23
            return false;
23
            return false;   
24
        }
24
        }
25
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
25
        if (this.roundXCoordinates != that.roundXCoordinates) {
26
            return false;
26
            return false;
27
        }
27
        }
28
        return true;
28
        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)5.7
Clones locationClones are in different classes
Number of node comparisons113
  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 fragment3
    Time elapsed for statement mapping (ms)5.7
    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 XYDifferenceRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof XYDifferenceRenderer))
    4
    return false;
    4
    return false;
    5
    CategoryLineAnnotation that = (CategoryLineAnnotation)obj;
                                                                                                                          
    6
    if (!this.category1.equals(that.getCategory1()))
    6
    if (!this.category1.equals(that.getCategory1()))
    5
    if (!super.equals(obj))
    Differences
    Expression1Expression2Difference
    this.category1.equals(that.getCategory1())super.equals(obj)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
    Super method call if(!super.equals(obj)) cannot be extracted from method
    5
    if (!super.equals(obj))
    7
    return false;
    6
    return false;
                                                                                                                  
    7
    XYDifferenceRenderer that = (XYDifferenceRenderer)obj;
    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 (!PaintUtilities.equal(this.negativePaint, that.negativePaint))
    Differences
    Expression1Expression2Difference
    this.category2.equals(that.getCategory2())PaintUtilities.equal(this.negativePaint,that.negativePaint)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 PaintUtilities.equal(this.negativePaint,that.negativePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!PaintUtilities.equal(this.negativePaint, that.negativePaint))
    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))
    8
    if (!PaintUtilities.equal(this.positivePaint, that.positivePaint))
    Differences
    Expression1Expression2Difference
    paintpositivePaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    paintpositivePaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.positivePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!PaintUtilities.equal(this.positivePaint, that.positivePaint))
    15
    return false;
    9
    return false;
                                                                                                    
    12
    if (this.shapesVisible != that.shapesVisible)
                                      
    13
    return false;
    Preondition Violations
    Unmatched return false;
    13
    return false;
    16
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    16
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    14
    if (!ShapeUtilities.equal(this.legendLine, that.legendLine))
    Differences
    Expression1Expression2Difference
    strokelegendLineVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.CategoryLineAnnotationorg.jfree.chart.renderer.xy.XYDifferenceRendererSUBCLASS_TYPE_MISMATCH
    strokelegendLineVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.ShapeVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.ShapeUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Shape of variable this.legendLine
    • Make classes java.awt.Stroke and java.awt.Shape extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.legendLine 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 java.awt.Shape of variable that.legendLine
    • Make classes java.awt.Stroke and java.awt.Shape extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.ShapeUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.ShapeUtilities extend a common superclass
    14
    if (!ShapeUtilities.equal(this.legendLine, that.legendLine))
    17
    return false;
    15
    return false;
    Precondition Violations (16)
    Row Violation
    1Expression this.category1.equals(that.getCategory1()) 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 this.category2.equals(that.getCategory2()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression PaintUtilities.equal(this.negativePaint,that.negativePaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Unmatched return false;
    7Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression that.positivePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Unmatched return false;
    10Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Shape of variable this.legendLine
    11Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.legendLine cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Type java.awt.Stroke of variable that.stroke does not match with type java.awt.Shape of variable that.legendLine
    14Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.ShapeUtilities
    15Not all possible execution flows end in a return statement
    16The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.CategoryLineAnnotation and org.jfree.chart.renderer.xy.XYDifferenceRenderer do not have a common superclass