if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYPolygonAnnotation)) { return false; } XYPolygonAnnotation that = (XYPolygonAnnotation) obj; if (!Arrays.equals(this.polygon, that.polygon)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } // seem to be the same return true;
if (this == obj) { return true; } if (!(obj instanceof HighLowRenderer)) { return false; } HighLowRenderer that = (HighLowRenderer) obj; if (this.drawOpenTicks != that.drawOpenTicks) { return false; } if (this.drawCloseTicks != that.drawCloseTicks) { return false; } if (!PaintUtilities.equal(this.openTickPaint, that.openTickPaint)) { return false; } if (!PaintUtilities.equal(this.closeTickPaint, that.closeTickPaint)) { return false; } if (this.tickLength != that.tickLength) { return false; } if (!super.equals(obj)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYPolygonAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/HighLowRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 18
1
if (obj == this) {
1
if (this == obj) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        // now try to reject equality
4
        
5
        if (!super.equals(obj)) {
6
            return false;
7
        }
8
        if (!(obj instanceof XYPolygonAnnotation)) {
9
            return false;
10
        }
11
        XYPolygonAnnotation that = (XYPolygonAnnotation) obj;
12
        if (!Arrays.equals(this.polygon, that.polygon)
5
if (!(obj instanceof HighLowRenderer)) {
6
            return false;
7
        }
8
        HighLowRenderer that = (HighLowRenderer) obj;
9
        if (this.drawOpenTicks != that.drawOpenTicks) {
10
            return false;
11
        }
13
) {
12
        if (this.drawCloseTicks != that.drawCloseTicks) {
14
            return false;   
13
            return false;
15
        }
14
        }
16
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
15
        if (!PaintUtilities.equal(this.openTickPaint, that.openTickPaint)) {
17
            return false;
16
            return false;
18
        }
17
        }
19
        if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) {
18
        if (!PaintUtilities.equal(this.closeTickPaint, that.closeTickPaint)) {
20
            return false;
19
            return false;
21
        }
20
        }
22
        if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) {
21
        if (
23
            return false;
24
        }
25
        // seem to be the same
22
this.tickLength != that.tickLength) {
23
            return false;
24
        }
25
        if (!super.equals(obj)) {
26
            return false;
27
        }
26
        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)4.6
Clones locationClones are in different classes
Number of node comparisons87
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)5.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    if (!super.equals(obj))
    3
    if (!super.equals(obj))
    16
    if (!super.equals(obj))
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    Super method call if(!super.equals(obj)) cannot be extracted from method
    16
    if (!super.equals(obj))
    4
    return false;
    17
    return false;
    5
    if (!(obj instanceof XYPolygonAnnotation))
    5
    if (!(obj instanceof XYPolygonAnnotation))
    3
    if (!(obj instanceof HighLowRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.xy.HighLowRendererSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof HighLowRenderer))
    6
    return false;
    4
    return false;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    5
    HighLowRenderer that = (HighLowRenderer)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.xy.HighLowRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.xy.HighLowRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.xy.HighLowRendererSUBCLASS_TYPE_MISMATCH
    5
    HighLowRenderer that = (HighLowRenderer)obj;
                                                                                                  
    6
    if (this.drawOpenTicks != that.drawOpenTicks)
    Preondition Violations
    Unmatched statement if(this.drawOpenTicks != that.drawOpenTicks) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    if (this.drawOpenTicks != that.drawOpenTicks)
                                    
    7
    return false;
    Preondition Violations
    Unmatched return false;
    7
    return false;
                                                                                                      
    8
    if (this.drawCloseTicks != that.drawCloseTicks)
    Preondition Violations
    Unmatched statement if(this.drawCloseTicks != that.drawCloseTicks) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    if (this.drawCloseTicks != that.drawCloseTicks)
                                    
    9
    return false;
    Preondition Violations
    Unmatched return false;
    9
    return false;
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    Preondition Violations
    Unmatched statement if(!Arrays.equals(this.polygon,that.polygon)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!PaintUtilities.equal(this.openTickPaint, that.openTickPaint))
    Differences
    Expression1Expression2Difference
    strokeopenTickPaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.xy.HighLowRendererSUBCLASS_TYPE_MISMATCH
    strokeopenTickPaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Paint of variable this.openTickPaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.openTickPaint 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.Paint of variable that.openTickPaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass
    10
    if (!PaintUtilities.equal(this.openTickPaint, that.openTickPaint))
    11
    return false;
    11
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.closeTickPaint, that.closeTickPaint))
    Differences
    Expression1Expression2Difference
    outlinePaintcloseTickPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.xy.HighLowRendererSUBCLASS_TYPE_MISMATCH
    outlinePaintcloseTickPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.closeTickPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (!PaintUtilities.equal(this.closeTickPaint, that.closeTickPaint))
    13
    return false;
    13
    return false;
                                                                                        
    14
    if (this.tickLength != that.tickLength)
    Preondition Violations
    Unmatched statement if(this.tickLength != that.tickLength) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14
    if (this.tickLength != that.tickLength)
                                      
    15
    return false;
    Preondition Violations
    Unmatched return false;
    15
    return false;
    Precondition Violations (19)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Unmatched statement if(this.drawOpenTicks != that.drawOpenTicks) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    5Unmatched statement if(this.drawCloseTicks != that.drawCloseTicks) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched return false;
    7Unmatched statement if(!Arrays.equals(this.polygon,that.polygon)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched return false;
    9Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Paint of variable this.openTickPaint
    10Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.openTickPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Type java.awt.Stroke of variable that.stroke does not match with type java.awt.Paint of variable that.openTickPaint
    13Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    14Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    15Expression that.closeTickPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Unmatched statement if(this.tickLength != that.tickLength) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    17Unmatched return false;
    18Clone fragment #1 returns variable that with type org.jfree.chart.annotations.XYPolygonAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.renderer.xy.HighLowRenderer
    19Not all possible execution flows end in a return statement